You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pressing "space" in the filter input results in nothing happening.
This is because of the accessibility "feature" that calls event.preventDefault() on the onKeyDown if 'Space' is pressed, leading to the onChange that would update the input value not being triggered at all.
This wasn't an issue on the v8, but now is one (breaking change) in the latest v10.
Code responsible for this :
constonHeaderElementKeyDown=(event,isHideButton)=>{switch(event.code){case'ArrowDown':
event.preventDefault();setFocusToFocusableFirstNode();break;case'ArrowUp':
event.preventDefault();focusInputRef.current&&DomHandler.focus(focusInputRef.current);break;case'Space': // <----- Triggered before the onChange eventcase'Enter':
case'NumpadEnter':
event.preventDefault();// <----- Prevents the onChange event from being triggered, prevent the usage of space char in the input fieldif(isHideButton){hide();}break;case'Escape':
onEscapeKey(event);break;default:
break;}};
This can be seen in the documentation itself, no need to create a project for this. In the example, there are options with spaces in them such as "Robert De Niro", but it is not possible to perform an exact search for them without spaces. https://primereact.org/treeselect/#filter
Create a <TreeSelect /> with options containing spaces and filtering enabled
Try to type "space" character in the input field
Expected behavior
When pressing the spacebar, a space should be added in the filter input.
This would remove the usage of "space" as accessibility key, but "enter" would still do the same job and is usually more common to use than "space" to select anyway.
Allowing for spaces could also add the possibility of splicing words and perform searchs on all of them individually instead of looking for a perfect match with spaces, allowing for more flexibility in search results.
The text was updated successfully, but these errors were encountered:
There's another 'Space' check on key down, and I don't know if this also has an impact on this issue.
Thought I would mention it here while you work on the issue @Rekl0w :
melloware
added
Type: Bug
Issue contains a defect related to a specific component.
and removed
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
labels
Jun 13, 2024
Describe the bug
Pressing "space" in the filter input results in nothing happening.
This is because of the accessibility "feature" that calls
event.preventDefault()
on theonKeyDown
if 'Space' is pressed, leading to theonChange
that would update the input value not being triggered at all.This wasn't an issue on the v8, but now is one (breaking change) in the latest v10.
Code responsible for this :
Link to this function :
primereact/components/lib/treeselect/TreeSelect.js
Line 197 in 747d484
This can be seen in the documentation itself, no need to create a project for this. In the example, there are options with spaces in them such as "Robert De Niro", but it is not possible to perform an exact search for them without spaces.
https://primereact.org/treeselect/#filter
Reproducer
https://primereact.org/treeselect/#filter
PrimeReact version
10.6.6
React version
18.x
Language
TypeScript
Build / Runtime
Vite
Browser(s)
No response
Steps to reproduce the behavior
<TreeSelect />
with options containing spaces and filtering enabledExpected behavior
When pressing the spacebar, a space should be added in the filter input.
This would remove the usage of "space" as accessibility key, but "enter" would still do the same job and is usually more common to use than "space" to select anyway.
Allowing for spaces could also add the possibility of splicing words and perform searchs on all of them individually instead of looking for a perfect match with spaces, allowing for more flexibility in search results.
The text was updated successfully, but these errors were encountered: