Skip to content

feat: improve useSafeZoneArea() hook #34677

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
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

layershifter
Copy link
Member

@layershifter layershifter commented Jun 18, 2025

New Behavior

  • usePositioning() hook is re-exported from @fluentui/react-components
  • useSafeZoneArea() hook is re-export from @fluentui/react-components
  • useSafeZoneArea() was heavily re-implemented internally based on the latest findings in the integration process
  • Added documentation for useSafeZoneArea() hook

Re-implementation details

Instead of a single triangle, we draw four now, but they cover possible scenarios unlike before. The previous implementation supported only this case (when a trigger is smaller then a container):

2025-06-18.17.40.56.mp4

Updated implementation supported a vice-versa case too:

2025-06-18.17.40.14.mp4

The rendering was also switches to React instead of direct DOM updates as it became too complicated.

Related Issue(s)

  • Fixes #

Copy link

github-actions bot commented Jun 18, 2025

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.264 MB
317.952 kB
1.27 MB
320.04 kB
5.803 kB
2.088 kB
react-positioning
useSafeZoneArea
12.498 kB
4.758 kB
12.325 kB
4.942 kB
-173 B
184 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-avatar
Avatar
49.424 kB
15.845 kB
react-avatar
AvatarGroup
20.224 kB
7.99 kB
react-avatar
AvatarGroupItem
63.568 kB
20.059 kB
react-breadcrumb
@fluentui/react-breadcrumb - package
115.118 kB
31.877 kB
react-checkbox
Checkbox
35.241 kB
12.109 kB
react-combobox
Combobox (including child components)
107.663 kB
35.031 kB
react-combobox
Dropdown (including child components)
108.293 kB
34.976 kB
react-components
react-components: Button, FluentProvider & webLightTheme
69.779 kB
20.273 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
227.642 kB
65.909 kB
react-components
react-components: FluentProvider & webLightTheme
44.613 kB
14.641 kB
react-datepicker-compat
DatePicker Compat
227.366 kB
64.387 kB
react-dialog
Dialog (including children components)
102.593 kB
30.76 kB
react-field
Field
23.561 kB
8.937 kB
react-input
Input
28.137 kB
9.476 kB
react-list
List
89.731 kB
26.718 kB
react-list
ListItem
113.073 kB
33.501 kB
react-menu
Menu (including children components)
157.289 kB
47.31 kB
react-menu
Menu (including selectable components)
160.271 kB
47.909 kB
react-overflow
hooks only
12.832 kB
4.828 kB
react-persona
Persona
56.315 kB
17.724 kB
react-popover
Popover
133.031 kB
41.442 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-positioning
usePositioning
28.865 kB
10.146 kB
react-progress
ProgressBar
17.202 kB
6.919 kB
react-radio
Radio
32.789 kB
10.375 kB
react-radio
RadioGroup
15.878 kB
6.462 kB
react-select
Select
27.856 kB
10.16 kB
react-slider
Slider
38.175 kB
12.82 kB
react-spinbutton
SpinButton
35.337 kB
11.785 kB
react-swatch-picker
@fluentui/react-swatch-picker - package
106.945 kB
30.882 kB
react-switch
Switch
35.418 kB
11.352 kB
react-table
DataGrid
162.123 kB
45.891 kB
react-table
Table (Primitives only)
42.884 kB
13.906 kB
react-table
Table as DataGrid
132.381 kB
36.697 kB
react-table
Table (Selection only)
70.752 kB
20.038 kB
react-table
Table (Sort only)
69.395 kB
19.651 kB
react-tag-picker
@fluentui/react-tag-picker - package
189.011 kB
56.699 kB
react-tags
InteractionTag
15.552 kB
6.249 kB
react-tags
Tag
30.717 kB
9.991 kB
react-tags
TagGroup
84.078 kB
24.939 kB
react-teaching-popover
TeachingPopover
102.747 kB
30.737 kB
react-textarea
Textarea
26.704 kB
9.784 kB
react-timepicker-compat
TimePicker
110.646 kB
36.578 kB
react-tooltip
Tooltip
58.686 kB
20.336 kB
react-tree
FlatTree
148.849 kB
42.711 kB
react-tree
PersonaFlatTree
149.607 kB
42.818 kB
react-tree
PersonaTree
145.865 kB
41.699 kB
react-tree
Tree
145.113 kB
41.575 kB
🤖 This report was generated against ddb50b0e9313fe7eb75830a0546d01a2c7fe270b

Copy link

Pull request demo site: URL

@layershifter layershifter force-pushed the fix/improve-safe-zone branch from d3312cd to bd61426 Compare June 18, 2025 15:48
@@ -0,0 +1,7 @@
{
Copy link

@github-actions github-actions bot Jun 18, 2025

Choose a reason for hiding this comment

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

🕵🏾‍♀️ visual changes to review in the Visual Change Report

vr-tests-react-components/Drawer 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Drawer.overlay drawer full - RTL.chromium.png 1157 Changed
vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.chromium.png 829 Changed
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 717 Changed
vr-tests-react-components/TagPicker 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/TagPicker.disabled - RTL.chromium.png 635 Changed
vr-tests-react-components/TagPicker.disabled - High Contrast.chromium.png 1321 Changed
vr-tests-react-components/TagPicker.disabled.disabled input hover.chromium.png 678 Changed

There were 3 duplicate changes discarded. Check the build logs for more information.

@layershifter layershifter force-pushed the fix/improve-safe-zone branch from bd61426 to 03f4238 Compare June 18, 2025 16:11
@layershifter layershifter marked this pull request as ready for review June 18, 2025 16:40
@layershifter layershifter requested review from a team as code owners June 18, 2025 16:40
@Hotell Hotell requested a review from dmytrokirpa June 19, 2025 12:07
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.

1 participant