Comments (4)
Maybe we could modify
react-spectrum/packages/@react-aria/combobox/src/useComboBox.ts
Lines 118 to 120 in 64ed130
preventDefault
if the user is in an allowsCustomValue
combobox and none of the keys are focused?from react-spectrum.
Correct me if I'm wrong, but this issue is only a problem when both allowsCustomValue
and allowsEmptyCollection
are specified, right? I've noticed that if only allowsCustomValue
is set, then the combobox would close automatically when the typed input doesn't match any of the items, and thus the form is submitted via a single enter
keystroke.
So I'm not entirely sure if it's a good idea to add an additional logic in the above if-statement to handle this specific use case? since it makes sense to close the menu first (even if it's an empty one), and then submit the form?
Would there be a better way to deal with this?
from react-spectrum.
There could also be the case where the user's custom value is a substring of the combobox's dropdown values in which case the dropdown would be open still even if allowsEmptyCollection
is false. Open to alternative ideas/opinions but it feels to me that as long as virtual focus isn't set within the dropdown then we can treat interactions as happening purely on the input element and thus we no longer need to prevent default.
from react-spectrum.
For now, I've added a workaround that adds a keypress event listener to the input and manually triggers a click on a submit button we have in our component if there's no focusedKey
from react-spectrum.
Related Issues (20)
- usePopover: border-radius is not accounted for with Arrow Positioning HOT 4
- '"react-aria-components"' has no exported member named 'TextFieldProps'. HOT 3
- @react-aria/utils platform functions results are cached in test environment HOT 3
- Opening/closing Select causes layoutshift HOT 1
- [RAC] - "Select" cannot disable focus on ListBoxItem hover. HOT 6
- [RAC] - Ability to unselect a ListBoxItem in an uncontrolled Select HOT 2
- `NumberField` breaks when value is less than 3 for `locale="ar"` HOT 1
- Tooltip: crossOffset is not working HOT 4
- Table View: Text field inside a table view is not editable when clicked HOT 1
- Example for RAC Select with complex items is missing HOT 9
- Select and ComboBox submit value as react-aria-1, react-aria-2 etc. HOT 2
- Button implemented with useButton() can't be used to open a Menu HOT 3
- Link stuck in pressed state when opened with keyboard HOT 1
- [RAC] Tooltip on button in Table Cells break the hover state of actionable Row HOT 1
- Exception when nesting both <TabList> and <Menu> under <Tabs> HOT 3
- [RAC] Add layout="grid" to GridList HOT 2
- Allow passing data attributes to FieldError HOT 2
- allowTextSelectionOnPress isn't working for `usePress` HOT 1
- `data-hovered` props is being eaten HOT 3
- Table dynamic collections, useAsyncList, and useMemo/useCallback/etc can easily interact to create memory leaks HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-spectrum.