-
Notifications
You must be signed in to change notification settings - Fork 11
Align positioning behavior of rich-text mention listbox, combobox, select, and menu button #2597
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
Open
m-akinc
wants to merge
18
commits into
main
Choose a base branch
from
users/makinc/mention-listbox-positioning
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f5846d5
Allow rich-text mention listbox to open above the cursor
m-akinc cb40174
Change files
m-akinc 82f818f
Align to listbox implementation
rajsite 3614999
Fix inconsistency with select/combobox
m-akinc fe2e3e0
Make combobox and select use AR's dynamic vertical positioning
m-akinc 58f4d79
Update stories and add visual test cases
m-akinc a9b2679
Update change file comment
m-akinc ec65b41
Fix description
m-akinc 9f63710
Avoid "undefined" in class list
m-akinc 9ecf56b
Ensure document element takes up full viewport in headless browser tests
m-akinc b39f755
Remove stale comment
m-akinc 5d67687
Adapt mention-listbox and update tests to wait for positioning
m-akinc ce53d60
Update visual tests and implement minimum dropdown height
m-akinc 43a4983
Remove unused import
m-akinc 9f905d3
Reduce size of containing div for two existing select visual tests
m-akinc 326327e
Tweak div boundary
m-akinc e8d5c29
Update fast-react-wrapper, too
m-akinc 2fdca65
Revert "Update fast-react-wrapper, too"
m-akinc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@ni-nimble-components-f4992b1c-b7f0-46e1-a684-b5afff8683f6.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
m-akinc marked this conversation as resolved.
Show resolved
Hide resolved
m-akinc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "type": "patch", | ||
m-akinc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "comment": "Align positioning behavior of rich-text mention listbox, combobox, select, and menu button", | ||
| "packageName": "@ni/nimble-components", | ||
| "email": "[email protected]", | ||
| "dependentChangeType": "patch" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,42 +202,55 @@ export const styles = css` | |
| margin-inline-start: auto; | ||
| } | ||
|
|
||
| :host([open][position='above']) .anchored-region { | ||
| padding-bottom: ${smallPadding}; | ||
| } | ||
|
|
||
| :host([open][position='below']) .anchored-region { | ||
| :host([open]) .anchored-region { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Simpler and harmless to add padding to both top and bottom of anchored region without worrying about its positioning. |
||
| padding-top: ${smallPadding}; | ||
| padding-bottom: ${smallPadding}; | ||
| } | ||
|
|
||
| .listbox { | ||
| display: inline-flex; | ||
| flex-direction: column; | ||
| width: 100%; | ||
| --ni-private-listbox-visible-option-count: 10.5; | ||
| --ni-private-listbox-minimum-visible-option-count: 1.5; | ||
| --ni-private-listbox-anchor-element-gap: ${smallPadding}; | ||
| --ni-private-listbox-padding: ${smallPadding}; | ||
| --ni-private-listbox-filter-height: 0px; | ||
| --ni-private-listbox-loading-indicator-height: 0px; | ||
| max-height: min( | ||
| calc( | ||
| var(--ni-private-listbox-anchor-element-gap) + | ||
| 2 * ${borderWidth} + | ||
| var(--ni-private-listbox-padding) + | ||
| ${controlHeight} * var(--ni-private-listbox-visible-option-count) + | ||
| var(--ni-private-listbox-filter-height) + | ||
| var(--ni-private-listbox-loading-indicator-height) | ||
| ), | ||
| calc( | ||
| var(--ni-private-listbox-available-viewport-height) - | ||
| var(--ni-private-listbox-anchor-element-gap) | ||
| ) | ||
| --ni-private-listbox-boilerplate-height: calc( | ||
| var(--ni-private-listbox-anchor-element-gap) + | ||
| 2 * ${borderWidth} + | ||
| var(--ni-private-listbox-padding) + | ||
| var(--ni-private-listbox-filter-height) + | ||
| var(--ni-private-listbox-loading-indicator-height) | ||
| ); | ||
| --ni-private-listbox-ideal-height: calc( | ||
| var(--ni-private-listbox-boilerplate-height) + | ||
| ${controlHeight} * var(--ni-private-listbox-visible-option-count) | ||
| ); | ||
| --ni-private-listbox-minimum-height: calc( | ||
| var(--ni-private-listbox-boilerplate-height) + | ||
| ${controlHeight} * var(--ni-private-listbox-minimum-visible-option-count) | ||
| ); | ||
| max-height: var(--ni-private-listbox-ideal-height); | ||
| box-shadow: ${elevation2BoxShadow}; | ||
| border: ${borderWidth} solid ${popupBorderColor}; | ||
| background-color: ${applicationBackgroundColor}; | ||
| } | ||
|
|
||
| .anchored-region.confined-to-view .listbox { | ||
| max-height: max( | ||
| min( | ||
| var(--ni-private-listbox-ideal-height), | ||
| calc( | ||
| var(--ni-private-listbox-available-viewport-height) - | ||
| var(--ni-private-listbox-anchor-element-gap) | ||
| ) | ||
| ), | ||
| var(--ni-private-listbox-minimum-height) | ||
| ); | ||
| } | ||
|
|
||
| .listbox:has(.filter-field) { | ||
| --ni-private-listbox-filter-height: ${controlHeight}; | ||
| } | ||
|
|
@@ -246,12 +259,12 @@ export const styles = css` | |
| --ni-private-listbox-loading-indicator-height: ${controlHeight}; | ||
| } | ||
|
|
||
| :host([open][position='above']) .listbox { | ||
| :host([open]) .listbox.top{ | ||
| border-bottom-left-radius: 0; | ||
| border-bottom-right-radius: 0; | ||
| } | ||
|
|
||
| :host([open][position='below']) .listbox { | ||
| :host([open]) .listbox.bottom{ | ||
| border-top-left-radius: 0; | ||
| border-top-right-radius: 0; | ||
| } | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.