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 #6809: Make sure editable dropdown opens when user types #6810

Merged

Conversation

peconomou929
Copy link
Contributor

@peconomou929 peconomou929 commented Jul 1, 2024

Fix #6809.

This bug did not always exist. It was first introduced in #6032.

Copy link

vercel bot commented Jul 1, 2024

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

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
primereact ⬜️ Ignored (Inspect) Visit Preview Jul 1, 2024 11:15am
primereact-v9 ⬜️ Ignored (Inspect) Visit Preview Jul 1, 2024 11:15am

Copy link

github-actions bot commented Jul 1, 2024

Thanks a lot for your contribution! But, PR does not seem to be linked to any issues. Please manually link to an issue or mention it in the description using #<issue_id>.

@melloware melloware added the Type: Bug Issue contains a defect related to a specific component. label Jul 1, 2024
@melloware
Copy link
Member

@peconomou929 can you retest the issue in #6027 that caused me to make the original change please?

Copy link
Member

@melloware melloware left a comment

Choose a reason for hiding this comment

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

I must have had a good reason to make this change

@peconomou929
Copy link
Contributor Author

@melloware I am testing my changes with a dropdown that has filter=true and editable=true and the issue in #6027 is not present.

@melloware
Copy link
Member

Nice! From looking at this code again it has me wondering. Why don't show() and hide() just check the overlayvisible state instead of everywhere in the code?

Like for example:

const show = () => {
            if (overlayVisibleState) return;

            setFocusedOptionIndex(focusedOptionIndex !== -1 ? focusedOptionIndex : props.autoOptionFocus ? findFirstFocusedOptionIndex() : props.editable ? -1 : findSelectedOptionIndex());
            setOverlayVisibleState(true);
        };

I know its not related to your PR but doesn't it make sense that show() and hide() would just check the overlayVisibleState?

@peconomou929
Copy link
Contributor Author

Nice! From looking at this code again it has me wondering. Why don't show() and hide() just check the overlayvisible state instead of everywhere in the code?

Hmm, I see your point. It might make sense to do that, but I'm not entirely sure it's a good idea (for now at least). For example, the hide function is

const hide = () => {
    setOverlayVisibleState(false);
    clickedRef.current = false;
};

In addition to setting the visible state, it also sets the clickedRef. What if somebody calls the hide function (perhaps one of the current usages of hide) and expects the clickedRef to always be set to false?

@melloware
Copy link
Member

ok i will take a look!

@melloware melloware merged commit ff4c3e2 into primefaces:master Jul 1, 2024
8 of 9 checks passed
@peconomou929 peconomou929 deleted the fix/editable-dropdown-open-on-type branch July 27, 2024 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dropdown: does not open OnEditableInputChange
2 participants