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

TextInput trailing action design and API update #2033

Merged
merged 15 commits into from
Apr 25, 2022

Conversation

mperrotti
Copy link
Contributor

Changes:

  • Inner action's hover bg should not touch the text input edges
  • Increases touch target area of the inner action button
  • Deprecation: we only want to allow inner action buttons to be icon buttons
  • Deprecation: we only want to allow inner action buttons to be the 'invisible' variant

Screenshots

Before:
innerAction-before

After:
innerAction-after

Merge checklist

  • [n/a] Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@mperrotti mperrotti requested review from a team and jfuchs April 19, 2022 13:46
@changeset-bot
Copy link

changeset-bot bot commented Apr 19, 2022

🦋 Changeset detected

Latest commit: 9b9c963

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Apr 19, 2022

size-limit report 📦

Path Size
dist/browser.esm.js 65.64 KB (+0.14% 🔺)
dist/browser.umd.js 65.98 KB (+0.12% 🔺)

@siddharthkp
Copy link
Member

siddharthkp commented Apr 19, 2022

Inner action's hover bg should not touch the text input edges

The tooltip container seems to be positioned awkwardly here. You can hover and get the tooltip but you're not on the button yet so a click doesn't trigger the button.

Kapture.2022-04-19.at.18.28.42.mp4

 

Increases touch target area of the inner action button

24x24, does this meet our minimum button size for a11y? How do we solve for this when it's limited by the container's size?

image

@mperrotti
Copy link
Contributor Author

The tooltip container seems to be positioned awkwardly here

Great catch! I'll fix that.


24x24, does this meet our minimum button size for a11y?

We increase the size of the clickable area for pointer: coarse: https://github.com/primer/react/pull/2033/files#diff-6d020864785e702f00d29d3c98e3259b410704ba0090553a47b510456871c7c2R30

@siddharthkp
Copy link
Member

We increase the size of the clickable area for pointer: coarse

TIL!

@mperrotti mperrotti temporarily deployed to github-pages April 21, 2022 14:10 Inactive
Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

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

Looking good overall! Left a few comments on tiny details.

Approving in advance :)

/** Text that appears in a tooltip. If an icon is passed, this is also used as the label used by assistive technologies. */
['aria-label']?: string
/** The icon to render inside the button */
icon?: React.FunctionComponent<IconProps>
/**
* @deprecated Text input action buttons should only use the 'invisible' button variant
Copy link
Member

@siddharthkp siddharthkp Apr 22, 2022

Choose a reason for hiding this comment

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

Question: Does this make it a breaking change? Would there be new warnings when someone upgrades primer/react?

How do we usually deprecate props?

Side note: Are there any users of TextInput.Action? Can we get away with this in patch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this make it a breaking change?

No, if they're still using variant, it will still work


Would there be new warnings when someone upgrades primer/react?

I think it would just be in their IDE


How do we usually deprecate props?

I don't think we have a defined process yet. Maybe @colebemis knows


Side note: Are there any users of TextInput.Action? Can we get away with this in patch

I don't think so. Even if there were, I think we can get away with this in a patch.

// when `size !== 'medium'`, vertical alignment of the icon is thrown off
// because changing the font size draws an em-box that does not match the
// bounding box of the SVG
{fontSize: 1},
Copy link
Member

@siddharthkp siddharthkp Apr 22, 2022

Choose a reason for hiding this comment

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

Option: Should we move this to getSizeStyles where fontSize is set?

if (iconOnly) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call!

- Inner action's hover bg should not touch the text input edges
- Increases touch target area of the inner action button
- Deprecation: we only want to allow inner action buttons to be icon buttons
- Deprecation: we only want to allow inner action buttons to be the 'invisible' variant
Copy link
Member

@siddharthkp siddharthkp Apr 22, 2022

Choose a reason for hiding this comment

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

Optional: Should we rephrase to look more like a change log?

"we only want to allow inner action buttons to be icon buttons" sounds a bit rude in a changelog 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well that's no good. Changing!

@mperrotti mperrotti temporarily deployed to needs-approval April 25, 2022 14:30 Inactive
@mperrotti mperrotti temporarily deployed to github-pages April 25, 2022 14:47 Inactive
@mperrotti mperrotti merged commit 0d7a871 into main Apr 25, 2022
@mperrotti mperrotti deleted the mp/textinput-inner-action-design-update branch April 25, 2022 17:38
@primer-css primer-css mentioned this pull request Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants