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

Fix <AutoCompleteInput> should not display a "Create" option when the filter is empty #10266

Merged
merged 8 commits into from
Oct 11, 2024

Conversation

erwanMarmelab
Copy link
Contributor

Problem

The “create option on-the-fly” UI of Autocomplete inputs is confusing. I can create an option with "" as value.
Fixes #10043

Solution

  • Don’t display “Create” on the input unless the user types something
  • Fix the brief flash of Create xxx -> xxx

How To Test

  • run ONLY=ra-ui-materialui make storybook
  • go to http://localhost:9010/?path=/story/ra-ui-materialui-input-autocompleteinput--on-create
  • clear the input and see that you cannot create an empty option

Additional Checks

  • The PR targets master for a bugfix, or next for a feature
  • The PR includes unit tests (if not possible, describe why)
    - [ ] The PR includes one or several stories (if not possible, describe why)
    - [ ] The documentation is up to date

Screencasts

Before flash fix:
Capture vidéo du 2024-09-25 19-42-25.webm
After:
Capture vidéo du 2024-09-25 19-43-16.webm

@erwanMarmelab
Copy link
Contributor Author

erwanMarmelab commented Oct 9, 2024

Following #10228 (cause of revert commits)

@erwanMarmelab erwanMarmelab added the RFR Ready For Review label Oct 9, 2024
@erwanMarmelab erwanMarmelab removed the RFR Ready For Review label Oct 9, 2024
@slax57 slax57 added the WIP Work In Progress label Oct 9, 2024
@erwanMarmelab erwanMarmelab added RFR Ready For Review and removed WIP Work In Progress labels Oct 10, 2024
@slax57 slax57 added WIP Work In Progress and removed RFR Ready For Review labels Oct 10, 2024
docs/AutocompleteInput.md Outdated Show resolved Hide resolved
Comment on lines +472 to +476
export const CreateLabel = () => (
<Wrapper>
<CreateLabelInput />
</Wrapper>
);
Copy link
Contributor

@slax57 slax57 Oct 11, 2024

Choose a reason for hiding this comment

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

Found an issue in this story, where the Autocomplete displays the Create option for an item that already exists

2024-10-11_14-16

EDIT: This issue seems to exist prior to this PR => Will be fixed in another PR

@slax57 slax57 added this to the 5.2.3 milestone Oct 11, 2024
@slax57 slax57 merged commit ff52bc6 into master Oct 11, 2024
2 checks passed
@slax57 slax57 deleted the fix/AutocompleteInput-create-data-on-fly branch October 11, 2024 12:40
@slax57 slax57 changed the title Hide <AutoCompleteInput> "Create" option for empty input Fix <AutoCompleteInput> should not display a "Create" option when the filter is empty Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<Autocomplete onCreate> briefly displays wrong option name
2 participants