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(Dropdown): pass option object value to selectItem when optionValue is set #7327

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

KumJungMin
Copy link
Contributor

@KumJungMin KumJungMin commented Oct 11, 2024

Defect Fixes



How to Resolve

  • When optionValue is set, selecting an option using [arrow keys + Enter] does not work.(related PR)
  • The issue is caused by the value being undefined.
  • To resolve this, I pass the option object to the selectItem function, similar to onOptionClick function.
const onOptionClick = (event) => {
      const option = event.option;

      if (!option.disabled) {
          selectItem(event);  // like this!
          DomHandler.focus(focusInputRef.current);
      }

      hide();
  };

Test 1: The optionValue is undefined(Basic example).

2024-10-11.9.13.22.mov



Test 2: The optionValue is set to 'code.'

  • you can select option using [arrow keys + Enter] :)
11111.mov

Copy link

vercel bot commented Oct 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
primereact ⬜️ Ignored (Inspect) Visit Preview Oct 11, 2024 0:19am
primereact-v9 ⬜️ Ignored (Inspect) Visit Preview Oct 11, 2024 0:19am

@melloware melloware merged commit 3f7e836 into primefaces:master Oct 11, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dropdown: Arrows select not working when using optionValue
2 participants