[go: nahoru, domu]

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(react-combobox): Wrong positioning of the listbox when there's not enough space #31891

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ValentinaKozlova
Copy link
Contributor
@ValentinaKozlova ValentinaKozlova commented Jul 1, 2024

Previous Behavior

The listbox is shown from the right or left side when there's no enough space

image

New Behavior

The listbox is not changing its position

image

Fixes #29050

@fabricteam
Copy link
Collaborator
fabricteam commented Jul 1, 2024

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 631 631 5000
Button mount 297 303 5000
Field mount 1138 1133 5000
FluentProvider mount 703 707 5000
FluentProviderWithTheme mount 87 84 10
FluentProviderWithTheme virtual-rerender 34 37 10
FluentProviderWithTheme virtual-rerender-with-unmount 73 80 10
MakeStyles mount 874 884 50000
Persona mount 1826 1797 5000
SpinButton mount 1409 1470 5000
SwatchPicker mount 1707 1729 5000

@fabricteam
Copy link
Collaborator
fabricteam commented Jul 1, 2024

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-combobox
Combobox (including child components)
103.571 kB
33.978 kB
103.501 kB
33.954 kB
-70 B
-24 B
react-combobox
Dropdown (including child components)
104.157 kB
33.888 kB
104.087 kB
33.865 kB
-70 B
-23 B
react-components
react-components: entire library
1.094 MB
270.794 kB
1.094 MB
270.757 kB
-70 B
-37 B
react-timepicker-compat
TimePicker
106.559 kB
35.517 kB
106.489 kB
35.49 kB
-70 B
-27 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
69.141 kB
20.157 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
211.741 kB
60.957 kB
react-components
react-components: FluentProvider & webLightTheme
44.442 kB
14.607 kB
react-portal-compat
PortalCompatProvider
8.39 kB
2.64 kB
react-tag-picker
@fluentui/react-tag-picker - package
181.187 kB
54.484 kB
🤖 This report was generated against 88db367fe6f7c7ed777a9b3e4e5da470aefbba30

@@ -1,4 +1,4 @@
import { PositioningShorthandValue, resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';
import { resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';
Copy link
Collaborator
@fabricteam fabricteam Jul 1, 2024

Choose a reason for hiding this comment

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

🕵 fluentuiv9 Open the Visual Regressions report to inspect the affected screenshots

Avatar Converged 2 screenshots
Image Name Diff(in Pixels) Image Type
Avatar Converged.badgeMask.normal.chromium.png 5 Changed
Avatar Converged.basic - Dark Mode.normal.chromium.png 0 Removed

@ValentinaKozlova ValentinaKozlova force-pushed the fix/combobox-last-item-selection branch from dec0943 to 2a90d29 Compare July 2, 2024 12:04
@ValentinaKozlova ValentinaKozlova marked this pull request as ready for review July 2, 2024 12:50
@ValentinaKozlova ValentinaKozlova requested review from smhigley and a team as code owners July 2, 2024 12:50
@sopranopillow sopranopillow changed the title fix(react-compobox): wrong positioning of the listbox when there's no… fix(react-combobox): Wrong positioning of the listbox when there's not enough space Jul 2, 2024
@@ -10,15 +10,11 @@ export function useComboboxPositioning(props: ComboboxBaseProps): [
] {
const { positioning } = props;

// Set a default set of fallback positions to try if the dropdown does not fit on screen
const fallbackPositions: PositioningShorthandValue[] = ['above', 'after', 'after-top', 'before', 'before-top'];
Copy link
Contributor

Choose a reason for hiding this comment

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

I think changing the fallbackPositions would need to be a larger conversation, since it'd be a breaking change. The current fallbackPositions values matches what we have in v8, which also allows the combobox/dropdown popup to render to the left or right of the trigger.

If we do change this, I think it should include above as a fallback to allow the popup to position above/below based on screen size. In general, I'm a bit leery of this change though, since it could make selection on short screens (and especially with zoom) a lot harder.

Teams can also currently override this through the positioning prop already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Cannot select last item in full-width combobox/dropdown
3 participants