Repository navigation
UI: Keep inline Autocomplete and Combobox list items clear of the scrollbar in stories - #86673
Conversation
…opover story The emoji grid's last column sat against a classic scrollbar, and the popover narrowed when search results stopped overflowing. Reserve the scrollbar's gutter, and extend the list body into the popover's padding so the scrollbar sits at the popover's edge.
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: 0 B Total Size: 8.65 MB
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in
|
…opover story The gutter only prevents width changes caused by the scrollbar. The popover still narrows when no results match.
In an inline Autocomplete or Combobox list, the items reach a classic scrollbar. Give the inline stories' list bodies an inline-end padding and a stable scrollbar gutter. Document the technique on ListBody, including the negative margin for a padded container such as a Popover, in place of the inline in popover story's description.
The constant only held comments that have since moved to ListBody, and the other inline stories set their list body styles inline.
ciampo
left a comment
There was a problem hiding this comment.
LGTM 🚀
Could ListBody leave a small gap between the highlighted item and a classic scrollbar by default? That would save consumers from adding the same padding to each inline list.
Do you think it would be useful if the popover story explained how scrollbar-gutter: stable keeps the picker the same width as results are filtered and how the negative inline-end margin moves the scrollbar to the popover’s edge?
Storybook does not show a subcomponent's description, so the ListBody guidance never reached the docs page. Restore the explanation in the inline in popover story, and explain the padding and gutter in the inline Autocomplete and Combobox stories.
Phrase the inline story descriptions as steps for consumers, so they don't read as default behavior, and split the ListBody description into shorter paragraphs.
This was also preferable to me, but unfortunately it leaves an unnecessary space if the list never overflows. So it's basically something the consumer needs to opt into, knowing that the their list overflows.
Added 👍 |
Gotcha, if we see a lot of reuse maybe we could turn it into a prop / data attribute, with the component providing the styles |
What?
Follow-up to #86338 and #86535
Keeps the items of inline
AutocompleteandComboboxlists clear of a classic scrollbar in the stories, and documents how to do it in the story descriptions and onListBody:Autocomplete"Inline In Popover" story, the emoji grid's scrollbar now sits at the popover's edge instead of against the last column, and the popover's width does not change when the scrollbar appears or disappears.Autocomplete"Inline" andCombobox"Detached Inline" stories, the highlighted item no longer runs into the scrollbar.Why?
Since #86535, the inline stories scroll inside
ListBody. With classic scrollbars, the items are flush with the scrollbar. In a popup, the popup's padding keeps them apart, but an inline list has no such padding. The special characters picker in #86338 had to solve this, and these stories are the examples that consumers copy.How?
The fix stays in the stories, which explain it, instead of the component adding the space itself. CSS can't tell whether the list overflows, so an automatic gap and gutter would make every inline list end short of the input even when it doesn't scroll. The component also can't know a container's padding, which the popover case needs.
Testing Instructions
scrollbar-gutter, and, for the popover, the negative margin.Screenshots or screencast
Autocomplete "Inline In Popover", with the last column highlighted:
Autocomplete "Inline In Popover", after searching for "dog":
Autocomplete "Inline", with the first item highlighted:
Combobox "Detached Inline", with the first item highlighted: