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
Is your feature request related to a problem? Please describe.
Users are getting confused when trying to clear search filters with backspace and accidentally deselecting items. Using backspace on an empty search bar to deselect items doesn't seem to be expected behavior for most people.
Describe the solution you'd like
Add a prop disablePoppingOnBackspace that defaults to false but is able to turn off this behavior.
Describe alternatives you've considered
Alternative could be disable by default and enable optionally but this would change existing behavior and likely wouldn't be ideal.
Additional context
//index.jsstaticpropTypes={//...tabIndex: PropTypes.number,disablePoppingOnBackspace: PropTypes.bool,}onKeyboardKeyDown=e=>{//...}elseif(!disablePoppingOnBackspace&&e.key==='Backspace'&&tags.length&&this.searchInput.value.length===0){constlastTag=tags.pop()this.onCheckboxChange(lastTag._id,false)}else{return}e.preventDefault()}//index.test.jstest('cannot delete tags on empty search input with backspace on keyboardNavigation with disablePoppingOnBackspace enabled',t=>{constdata=[{ ...node('a','a'),checked: true},{ ...node('b','b'),checked: true}]constwrapper=mount(<DropdownTreeSelectdata={data}disablePoppingOnBackspace={true}/>)wrapper.instance().searchInput.value='x'triggerOnKeyboardKeyDown(wrapper,'Backspace')t.deepEqual(wrapper.state().tags.length,2)wrapper.instance().searchInput.value=''triggerOnKeyboardKeyDown(wrapper,'Backspace')t.deepEqual(wrapper.state().tags.length,2)triggerOnKeyboardKeyDown(wrapper,'Backspace')t.deepEqual(wrapper.state().tags.length,2)})
The text was updated successfully, but these errors were encountered:
@r-zane-spalding thanks for the suggestion and filling out the details. This is a good idea, and your code looks sound. Would you mind sending a PR? We'd also need to add this to the docs.
Is your feature request related to a problem? Please describe.
Users are getting confused when trying to clear search filters with backspace and accidentally deselecting items. Using backspace on an empty search bar to deselect items doesn't seem to be expected behavior for most people.
Describe the solution you'd like
Add a prop disablePoppingOnBackspace that defaults to false but is able to turn off this behavior.
Describe alternatives you've considered
Alternative could be disable by default and enable optionally but this would change existing behavior and likely wouldn't be ideal.
Additional context
The text was updated successfully, but these errors were encountered: