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

feat(Listbox): auto dense #1195

Closed
wants to merge 6 commits into from
Closed

feat(Listbox): auto dense #1195

wants to merge 6 commits into from

Conversation

DanielS-Qlik
Copy link
Contributor

@DanielS-Qlik DanielS-Qlik commented Mar 28, 2023

Motivation

When the listbox container is smaller than a grid item, enable dense mode.
fixes qlik-oss/sn-list-objects#214 together with qlik-oss/sn-list-objects#220

Kapture 2023-03-28 at 14 43 32

Requirements checklist

  • Api specification
    • Ran yarn spec
      • No changes OR API changes has been formally approved
  • Unit/Component test coverage
  • Correct PR title for the changes (fix, chore, feat)

When build and tests have passed:

  • Add code reviewers, for example @qlik-oss/nebula-core

@Caele
Copy link
Collaborator

Caele commented Mar 28, 2023

There is a lot of logic and properties being passed around here, quite hard to follow its exact purpose.

What is is that triggers the auto dense setting? And does it simply result in dense being true?

@DanielS-Qlik
Copy link
Contributor Author

There is a lot of logic and properties being passed around here, quite hard to follow its exact purpose.

What is is that triggers the auto dense setting? And does it simply result in dense being true?

Basically it checks the height of element passed in here

async mount(element, options = {}) {
.
If it's in grid mode and that element is smaller than a grid item, it enables dense mode via autoDense.

The state needs to be kept in ListboxInline.jsx because it's used by the ListBoxSearch there.
Then the state is set in ListBox.jsx via useSetAutoDense() because it needs the loaderRef to detect the scollbar presence.

@veinfors
Copy link
Collaborator

I think we can wait with merging this as we might have better ideas to improve the behaviour instead...
(introducing a setting to the sn-filter-pane to explicitly control wether listboxes should collapse or not could help)

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.

Grid mode 1 row only works with "wide" grid spacing
3 participants