Skip to content

A workaround for the space issue in key-value editor [INS-5274]#8627

Merged
notjaywu merged 1 commit intodevelopfrom
fix/preserve-white-space
Apr 23, 2025
Merged

A workaround for the space issue in key-value editor [INS-5274]#8627
notjaywu merged 1 commit intodevelopfrom
fix/preserve-white-space

Conversation

@yaoweiprc
Copy link
Copy Markdown
Contributor

@yaoweiprc yaoweiprc commented Apr 18, 2025

Close #8091

When the user presses a letter key and then immediately presses the space bar.
The keydown event for the space key was stopped from propagating during the capture phase by the ListBox component
That is why the inner editor fails to respond to the immediate space press behavior.
Here we add a wrapper to the outer ListBox and add a wrapper to the inner editor and listen to the keydown event in both wrappers.
When the user presses the space key, we change the event.key property with non-breakable space in the outer wrapper and change it back in the inner wrapper.

@yaoweiprc yaoweiprc changed the title A workaround for the space issue in key-value editor A workaround for the space issue in key-value editor [INS-5274] Apr 18, 2025
@yaoweiprc yaoweiprc force-pushed the fix/preserve-white-space branch from e994b57 to 507aebc Compare April 18, 2025 03:59
@yaoweiprc yaoweiprc requested a review from a team April 18, 2025 04:34
@jackkav jackkav requested a review from gatzjames April 18, 2025 08:48
@jackkav
Copy link
Copy Markdown
Contributor

jackkav commented Apr 18, 2025

@gatzjames has expertise on key press handling in insomnia. I'll add him to reviewers, thanks @yaoweiprc

Copy link
Copy Markdown
Contributor

@gatzjames gatzjames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!
Looks like a sensible solution to me until there's a better way to handle propagation in react-aria

@notjaywu notjaywu force-pushed the fix/preserve-white-space branch from 507aebc to 32fed3c Compare April 23, 2025 09:39
@notjaywu notjaywu merged commit 1ae7116 into develop Apr 23, 2025
10 checks passed
@notjaywu notjaywu deleted the fix/preserve-white-space branch April 23, 2025 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spaces in a query parameter are not taken into account

4 participants