Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Focus/clicking issues with dialogs triggered from a table cell #1810

Closed
jluyau opened this issue Apr 20, 2021 · 1 comment · Fixed by #1840
Closed

Focus/clicking issues with dialogs triggered from a table cell #1810

jluyau opened this issue Apr 20, 2021 · 1 comment · Fixed by #1840
Labels
bug Something isn't working rsp:TableView

Comments

@jluyau
Copy link
Member

jluyau commented Apr 20, 2021

🐛 Bug Report

If a dialog is triggered from an action button in a table cell, clicking the dialog or the underlay will select the row from where the dialog was triggered. This prevents any dialog text selection or focus of any focusable children in the dialog content area. Clicking dialog buttons does still work however.

🤔 Expected Behavior

Clicks should not pass through the dialog/underlay and focusable children in the dialog should be focusable.

😯 Current Behavior

Clicks pass through the dialog (and select the table row). Focusable children in the dialog cannot be focused (e.g., textfields).

💁 Possible Solution

🔦 Context

💻 Code Sample

https://codesandbox.io/s/blue-dew-z0woi?file=/src/App.js

Click any of the action buttons to trigger a dialog. Click the dialog body or underlay and observe that the row will toggle selection or that clicking the textfield will not focus the textfield for text input.

🌍 Your Environment

Software Version(s)
react-spectrum 3.9.0
Browser Chrome
Operating System MacOS Catalina

🧢 Your Company/Team

Adobe/Quarry

🕷 Tracking Issue (optional)

@matthewdeutsch matthewdeutsch added bug Something isn't working rsp:TableView labels Apr 20, 2021
@devongovett
Copy link
Member

Probably because events bubble through portals in React. Two options:

  1. Stop propagation on all events at portal boundaries (e.g. overlays).
  2. Check if the ref contains the event target in the DOM in useSelectableItem. Or maybe even in usePress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rsp:TableView
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants