Skip to content
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

Select enter on form #1196

Merged
merged 4 commits into from
Mar 4, 2021

Conversation

anddrzejb
Copy link
Member

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • Bundle size optimization
  • Performance optimization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

Fixes #1176

💡 Background and solution

Except fixes to #1176, this commit also adds the following:

  1. Clear selection when "Delete" key or "Backspace" key pressed.
  2. Exposes new attribute DisableSubmitFormOnEnter: Default behavior for Select component on a Form is to submit on Enter. The exception is when Enter is pressed while select options are visible (then Enter will set picked option as the value). If DisableSubmitFormOnEnter = true then Enter will not submit on a Form.
  3. Interop gets a new event handler that prevents default for passed array of keys (more flexible)
  4. EditContext is notified about a change in Select component (if Form.ValidateOnChange == true)

Also, I can create a docs sample for DisableSubmitFormOnEnter behaviour based on this gif:
seelct_keyBehavior

📝 Changelog

Language Changelog
🇺🇸 English new attribute `DisableSubmitFormOnEnter'
🇨🇳 Chinese

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Changelog is provided or not needed

@ElderJames
Copy link
Member

ElderJames commented Mar 4, 2021

That's cool. I think we may not need this new property. The expected behavior is: as long as Enter is pressed when the select is focused, the form will not submit.

@anddrzejb
Copy link
Member Author

Let us get this straight - not when select is focused, but when select is focused and has overlay visible. When select is focused and no overlay is visible, then enter should submit the form.

@ElderJames
Copy link
Member

Yes, when overlay is closed, the select exits the edit state. Then enter should submit the form.

@anddrzejb
Copy link
Member Author

@ElderJames per request, the added functionality was removed in 6c5f8bc.

@ElderJames ElderJames enabled auto-merge (squash) March 4, 2021 15:15
@ElderJames ElderJames disabled auto-merge March 4, 2021 15:15
@ElderJames ElderJames merged commit 8771e52 into ant-design-blazor:master Mar 4, 2021
@anddrzejb anddrzejb deleted the selectEnterOnForm branch March 5, 2021 09:50
zxyao145 pushed a commit to zxyao145/ant-design-blazor that referenced this pull request Mar 20, 2021
…t-design-blazor#1196)

* fix(module:select): enter behavior on form

* fix(module:select): add DisableSubmitFormOnEnter attribute

* fix(module:select): remove proposed DisableSubmitFormOnEnter
ElderJames pushed a commit that referenced this pull request Apr 23, 2022
)

* fix(module:select): enter behavior on form

* fix(module:select): add DisableSubmitFormOnEnter attribute

* fix(module:select): remove proposed DisableSubmitFormOnEnte
ElderJames pushed a commit that referenced this pull request Apr 30, 2022
)

* fix(module:select): enter behavior on form

* fix(module:select): add DisableSubmitFormOnEnter attribute

* fix(module:select): remove proposed DisableSubmitFormOnEnte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Select Component Problem (Modal Form)
2 participants