Skip to content

feat(react-tags): make basic Tag a button instead of div#27858

Merged
YuanboXue-Amber merged 7 commits into
microsoft:masterfrom
YuanboXue-Amber:tag-focus
May 16, 2023
Merged

feat(react-tags): make basic Tag a button instead of div#27858
YuanboXue-Amber merged 7 commits into
microsoft:masterfrom
YuanboXue-Amber:tag-focus

Conversation

@YuanboXue-Amber

@YuanboXue-Amber YuanboXue-Amber commented May 16, 2023

Copy link
Copy Markdown
Contributor

Description

Before this PR, basic Tag has dismissButton slot to dismiss itself. This PR make the Tag itself a button that does dismiss, and changes dismissButton slot to dismissIcon. And this PR keeps TagButton unchanged - it's still two buttons.

before

root: NonNullable<Slot<'div'>>;
dismissButton?: Slot<'button'>;
image

after

root: NonNullable<Slot<'button'>>;
dismissIcon?: Slot<'span'>;
image
  • Why this change:
    In fluent v0 Pill, the focus ring is around the entire Pill. We would want the same for v9 basic Tag. Also this is useful for user with magnifier that tracks focus.

  • What does this mean for feat(react-tags): replace TagButton with Tag interactive prop #27794:
    I will keep two controls Tag/TagButton instead of one Tag, and close PR 27794. Because basic Tag and TagButton have different slots. The differences are:

    1. Basic Tag has dismiss icon (Slot<span>), while TagButton has dismiss button (Slot<button>)
    2. TagButton has content slot that wraps around media/primary and secondary text and act as first tab stop. Basic Tag does not need content slot.

@YuanboXue-Amber YuanboXue-Amber changed the title feat(react-tags): make basic tag a button instead of div feat(react-tags): make basic Tag a button instead of div May 16, 2023
@fabricteam

fabricteam commented May 16, 2023

Copy link
Copy Markdown
Collaborator

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-tags
Tag
21.687 kB
7.868 kB
20.637 kB
7.332 kB
-1.05 kB
-536 B

🤖 This report was generated against 06cd515eda59a3078bfe32f9cc7c1f281cd20208

@codesandbox-ci

codesandbox-ci Bot commented May 16, 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 ce95959:

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

@size-auditor

size-auditor Bot commented May 16, 2023

Copy link
Copy Markdown

Asset size changes

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

Baseline commit: 06cd515eda59a3078bfe32f9cc7c1f281cd20208 (build)

@YuanboXue-Amber YuanboXue-Amber marked this pull request as ready for review May 16, 2023 11:12
@YuanboXue-Amber YuanboXue-Amber requested review from a team as code owners May 16, 2023 11:12
Comment thread packages/react-components/react-tags/src/utils/useTagContextValues.ts Outdated

@ling1726 ling1726 left a comment

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.

Root tag being a button makes so much more sense, and it looks nicer than a dismiss button IMO

@bsunderhus bsunderhus left a comment

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.

LGTM

@YuanboXue-Amber YuanboXue-Amber enabled auto-merge (squash) May 16, 2023 15:11
@YuanboXue-Amber YuanboXue-Amber merged commit a644642 into microsoft:master May 16, 2023
@YuanboXue-Amber YuanboXue-Amber deleted the tag-focus branch May 16, 2023 15:12
marcosmoura added a commit to marcosmoura/fluentui that referenced this pull request May 18, 2023
* master: (24 commits)
  chore(react-tabster): upgrade tabster to v4.4.2 (microsoft#27540)
  feat(react-tags): Add TagGroup with context (microsoft#27886)
  applying package updates
  fix(react-infobutton): Add aria-owns to InfoLabel (microsoft#27834)
  fix(recipes-react-components): Add a FluentProvider to the local storybook (microsoft#27746)
  chore: update RFC template (microsoft#27880)
  applying package updates
  feat: implement Toaster offset (microsoft#27854)
  feat(react-drawer): create DrawerFooter component (microsoft#27583)
  Make getKey and selection props mutually exclusive (microsoft#24048)
  Added MIGRATION.md to the Breadcrumb (microsoft#27846)
  update Github CODEOWNERS file (microsoft#27849)
  feat(react-tags): make basic Tag a button instead of div (microsoft#27858)
  chore: add test-ssr script to v9 packages (microsoft#27690)
  chore(react-tree): exports TreeItemAside unstable (microsoft#27856)
  bugfix(react-dialog): removes unnecessary grid gaps (microsoft#27845)
  applying package updates
  fix(react-textarea): Don't remove outline when filled and disabled and apply correct disabled color to text (microsoft#27837)
  feat: Implement limit for toast stacking (microsoft#27848)
  Update README.md for fluent 2 theme to include import instructions (microsoft#27847)
  ...
marcosmoura added a commit to marcosmoura/fluentui that referenced this pull request May 18, 2023
* feat/drawer-header: (24 commits)
  chore(react-tabster): upgrade tabster to v4.4.2 (microsoft#27540)
  feat(react-tags): Add TagGroup with context (microsoft#27886)
  applying package updates
  fix(react-infobutton): Add aria-owns to InfoLabel (microsoft#27834)
  fix(recipes-react-components): Add a FluentProvider to the local storybook (microsoft#27746)
  chore: update RFC template (microsoft#27880)
  applying package updates
  feat: implement Toaster offset (microsoft#27854)
  feat(react-drawer): create DrawerFooter component (microsoft#27583)
  Make getKey and selection props mutually exclusive (microsoft#24048)
  fix: move style override to outside the component
  Added MIGRATION.md to the Breadcrumb (microsoft#27846)
  update Github CODEOWNERS file (microsoft#27849)
  feat(react-tags): make basic Tag a button instead of div (microsoft#27858)
  chore: add test-ssr script to v9 packages (microsoft#27690)
  chore(react-tree): exports TreeItemAside unstable (microsoft#27856)
  bugfix(react-dialog): removes unnecessary grid gaps (microsoft#27845)
  applying package updates
  fix(react-textarea): Don't remove outline when filled and disabled and apply correct disabled color to text (microsoft#27837)
  feat: Implement limit for toast stacking (microsoft#27848)
  ...
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.

5 participants