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

Provide reachability of ClayDropdown.Menu props when calling ClayAutocomplete.Dropdown #4284

Closed
diegonvs opened this issue Sep 21, 2021 · 1 comment · Fixed by #4292
Closed
Assignees
Labels
comp: clay-components Issues related to Clay components. (e.g ClayCard, ClayLabel...) rfc Similar to the RFC that are used in React.js, Ember.js, Gatsby.js and Rust, but to mark problems tha

Comments

@diegonvs
Copy link
Contributor

What is your proposal?

This proposal cames from liferay-frontend/liferay-portal#1471 (comment),

ClayAutocomplete.Dropdown component is being used and the developer needed to create custom code to deal with clickOutside logic

A solution for avoiding people repeating this logic is to enable passing properties to ClayDropdown.Menu component that is being used internally in ClayAutocomplete.Dropdown.

<ClayAutocomplete.DropDown active={active} closeOnClickOutside>
    <div
        className="autocomplete-items"
        ref={dropdownRef}
    >
        {itemsWrapperRenderer({
            items,
            labelKey,
            onItemClick: onSelectedItemChange,
            valueKey,
        })}
    </div>
</ClayAutocomplete.DropDown>

Why would adopting this proposal be beneficial?

Avoid repetition of logic when using ClayAutocomplete.Dropdown

What are the alternatives to this proposal?

Creating a property called dropdownMenuProps?

It will look like:

<ClayAutocomplete.DropDown active={active} dropdownMenuProps={{closeOnClickOutside
: true}}>
    <div
        className="autocomplete-items"
        ref={dropdownRef}
    >
        {itemsWrapperRenderer({
            items,
            labelKey,
            onItemClick: onSelectedItemChange,
            valueKey,
        })}
    </div>
</ClayAutocomplete.DropDown>
@diegonvs diegonvs added the rfc Similar to the RFC that are used in React.js, Ember.js, Gatsby.js and Rust, but to mark problems tha label Sep 21, 2021
@matuzalemsteles matuzalemsteles added the comp: clay-components Issues related to Clay components. (e.g ClayCard, ClayLabel...) label Sep 21, 2021
@matuzalemsteles matuzalemsteles self-assigned this Sep 22, 2021
@github-actions
Copy link

This issue has been merged and will be released in DXP at https://issues.liferay.com/browse/LPS-130575

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: clay-components Issues related to Clay components. (e.g ClayCard, ClayLabel...) rfc Similar to the RFC that are used in React.js, Ember.js, Gatsby.js and Rust, but to mark problems tha
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants