Skip to content

feat: Add infoButton slot to Field#27030

Closed
behowell wants to merge 8 commits into
microsoft:masterfrom
behowell:field/infoButton-wrapper
Closed

feat: Add infoButton slot to Field#27030
behowell wants to merge 8 commits into
microsoft:masterfrom
behowell:field/infoButton-wrapper

Conversation

@behowell

@behowell behowell commented Mar 2, 2023

Copy link
Copy Markdown
Contributor

Previous Behavior

Field has no mechanism to correctly add an InfoButton after the label. The InfoButton needs to be outside of the label itself, so that the button's aria-label can be based on the label text.

New Behavior

Add two slots to Field:

  • labelWrapper - an extra div around the label and infoButton. Only rendered when there is an infoButton (otherwise the label is rendered by itself without a wrapper).
  • infoButton - a slot for the InfoButton itself.

Update InfoButton to allow it to be configured via context:

  • New InfoButtonContext that allows some default prop values to be provided via a context.
  • Add associatedLabelId prop so that the InfoButton can internally calculate its aria-labelledby

@fabricteam

fabricteam commented Mar 2, 2023

Copy link
Copy Markdown
Collaborator

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-checkbox
CheckboxField
39.996 kB
12.206 kB
41.328 kB
12.611 kB
1.332 kB
405 B
react-combobox
ComboboxField
81.926 kB
27.213 kB
83.258 kB
27.598 kB
1.332 kB
385 B
react-field
Field
17.673 kB
6.543 kB
19.005 kB
6.93 kB
1.332 kB
387 B
react-infobutton
InfoButton
127.411 kB
38.824 kB
127.673 kB
38.82 kB
262 B
-4 B
react-input
InputField
32.819 kB
10.111 kB
34.151 kB
10.486 kB
1.332 kB
375 B
react-progress
ProgressField
23.885 kB
8.385 kB
25.217 kB
8.766 kB
1.332 kB
381 B
react-radio
RadioGroupField
24.963 kB
9.07 kB
26.295 kB
9.452 kB
1.332 kB
382 B
react-select
SelectField
33.384 kB
10.779 kB
34.716 kB
11.164 kB
1.332 kB
385 B
react-slider
SliderField
42.922 kB
13.465 kB
44.254 kB
13.843 kB
1.332 kB
378 B
react-spinbutton
SpinButtonField
41.766 kB
12.254 kB
43.103 kB
12.649 kB
1.337 kB
395 B
react-switch
SwitchField
35.01 kB
10.655 kB
36.342 kB
11.037 kB
1.332 kB
382 B
react-textarea
TextareaField
36.537 kB
11.504 kB
37.869 kB
11.884 kB
1.332 kB
380 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-checkbox
Checkbox
33.091 kB
10.319 kB
react-combobox
Combobox (including child components)
85.509 kB
27.437 kB
react-combobox
Dropdown (including child components)
84.196 kB
27.191 kB
react-components
react-components: Button, FluentProvider & webLightTheme
67.061 kB
18.105 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
205.522 kB
57.033 kB
react-components
react-components: FluentProvider & webLightTheme
37.891 kB
12.039 kB
react-input
Input
22.94 kB
7.214 kB
react-portal-compat
PortalCompatProvider
6.324 kB
2.129 kB
react-progress
ProgressBar
13.59 kB
5.24 kB
react-radio
Radio
32.676 kB
10.616 kB
react-radio
RadioGroup
14.885 kB
5.933 kB
react-select
Select
24.145 kB
8.271 kB
react-slider
Slider
33.091 kB
10.555 kB
react-spinbutton
SpinButton
32.83 kB
9.864 kB
react-switch
Switch
28.225 kB
8.755 kB
react-table
DataGrid
144.785 kB
39.447 kB
react-table
Table (Primitives only)
43.776 kB
12.063 kB
react-table
Table as DataGrid
134.4 kB
34.514 kB
react-table
Table (Selection only)
82.316 kB
20.576 kB
react-table
Table (Sort only)
81.637 kB
20.386 kB
react-textarea
Textarea
26.336 kB
8.585 kB
🤖 This report was generated against 27c3cfe8a95bd26541c7c47ad2fd7fbc8ea332df

@size-auditor

size-auditor Bot commented Mar 2, 2023

Copy link
Copy Markdown

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: 27c3cfe8a95bd26541c7c47ad2fd7fbc8ea332df (build)

@@ -4,6 +4,7 @@ import { Checkbox } from '@fluentui/react-checkbox';
import { Combobox, Dropdown } from '@fluentui/react-combobox';

@fabricteam fabricteam Mar 2, 2023

Copy link
Copy Markdown
Collaborator

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 7 screenshots

✅ There was 7 screenshots added, 0 screenshots removed, 1868 screenshots unchanged, 0 screenshots with different dimensions and 0 screenshots with visible difference.

unknown 7 screenshots
Image Name Diff(in Pixels) Image Type
Field.infoButton+horizontal.default.chromium.png 0 Added
Field.infoButton+longLabel.default.chromium.png 0 Added
Field.infoButton+noLabel.default.chromium.png 0 Added
Field.infoButton+required.default.chromium.png 0 Added
Field.infoButton+size-large.default.chromium.png 0 Added
Field.infoButton+size-small.default.chromium.png 0 Added
Field.infoButton.default.chromium.png 0 Added

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like size small + infobutton has some alignment issues. The label is position on the top and the infobutton looks to be lower than the label. Is this expected? Same for large, but not as noticeable.

@fabricteam

fabricteam commented Mar 2, 2023

Copy link
Copy Markdown
Collaborator

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 1275 1268 5000
Button mount 934 930 5000
Field mount 1909 2004 5000
FluentProvider mount 1545 1563 5000
FluentProviderWithTheme mount 580 592 10
FluentProviderWithTheme virtual-rerender 544 555 10
FluentProviderWithTheme virtual-rerender-with-unmount 571 583 10
InfoButton mount 520 515 5000
MakeStyles mount 1956 1957 50000
Persona mount 2841 2802 5000
SpinButton mount 2271 2286 5000

@codesandbox-ci

codesandbox-ci Bot commented Mar 2, 2023

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 8032b68:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@behowell behowell changed the title Field/info button wrapper feat: Add infoButton slot to Field Mar 3, 2023
@behowell
behowell marked this pull request as ready for review March 7, 2023 18:01
@behowell
behowell requested review from a team and sopranopillow as code owners March 7, 2023 18:01
@behowell

behowell commented Mar 8, 2023

Copy link
Copy Markdown
Contributor Author

Moving back to draft status. Based on discussions with the team, we may instead want to create an InfoLabel component as in this PR:

@behowell
behowell marked this pull request as draft March 8, 2023 21:36
@behowell

Copy link
Copy Markdown
Contributor Author

Abandoning this PR in favor of using the InfoLabel component:

@behowell behowell closed this Mar 16, 2023
@behowell
behowell deleted the field/infoButton-wrapper branch February 15, 2024 21:34
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.

3 participants