-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
(Fixes #1214) Preventing type select in Table from highjacking textfield editing #1261
Closed
Closed
Changes from 8 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
ec94d58
adding isFocusWithinCell state to selection manager
LFDanLu ea9e5ff
moving blur to cell instead of cell child
LFDanLu 04f2fcd
adding test
LFDanLu afd899f
expand typeselect test a bit
LFDanLu 4fe03b9
updating code review
LFDanLu 5fca959
Merge branch 'main' into issue_1214
LFDanLu fc49d12
Merge branch 'main' into issue_1214
LFDanLu 4ebf38a
Merge branch 'main' into issue_1214
LFDanLu 469d292
Merge branch 'main' into issue_1214
LFDanLu 605267a
Merge branch 'main' into issue_1214
LFDanLu dc66d44
Merge branch 'main' of https://github.com/adobe/react-spectrum into i…
LFDanLu f428894
Merge branch 'main' of https://github.com/adobe/react-spectrum into i…
LFDanLu 6928ac1
Merge branch 'main' into issue_1214
LFDanLu f284a49
Merge branch 'main' into issue_1214
LFDanLu f73fc04
Merge branch 'main' into issue_1214
LFDanLu ae16f65
Merge branch 'main' of github.com:adobe/react-spectrum into issue_1214
LFDanLu 5f88db9
fixing merge
LFDanLu 4db4730
stopping propagation on keydown/up for textfields
LFDanLu 1ea4996
adding test for keydown/up stop propagation in useTextField
LFDanLu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is going to be too restrictive. There are many things that could be placed inside a table cell and receive focus, e.g. a switch, a button, etc. I don't think we'd want to restrict type select in these cases. We need to make this specific to textfields. There's been some talk of an edit mode for tables which may be something we should consider.
Did you try simply stopping propagation on keyboard events inside
useTextField
? Actually that's already the case viauseKeyboard
, but only if you pass in anonKeyDown
/onKeyUp
handler. Makes sense in general that we only do that if there's a handler, but for text fields, we should do it always I think since the input itself has default keyboard behavior (not implemented in JS). This should also fix cursor navigation with the arrow keys while editing a textfield inside a table cell as well, just just typeahead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember correctly, the problem here is that
useTypeSelect
has a capturing keydown listener, but lemme try againEDIT: yeah, the
useTypeSelect
capturing keydown listener is a problem because it picks up the keydown event first (as intended). I'll go ahead and stop propagation on keydown/up in useTextField anyways though for the arrow key functionality though, good catchThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only way I can think of making the current solution less restrictive is by checking a combination of
tagName
andtype
(and changing what gets set onselectionManager
instead ofsetFocusWithinItem
) whenfocus
fires inuseGridCell
which feels kinda gross. Implementing a edit mode for the table feels a lot cleaner. I can try to implement that in this PR instead or close this and open a new one, thoughts?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm yeah. I don't really remember why we made it a capturing listener, but seems like it has caused a bunch of issues (e.g. that useSelect issue you fixed). What breaks if we change it to not be a capturing listener?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason
useTypeSelect
uses capturing listeners is to capture thespace
keydowns that happen in Listbox/Table. If a user types "Item 1" we don't want thespace
keydown to select "Item 1".There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bump