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

TextInputWithTokens - adds the ability to hide text input tokens after a certain number #1523

Merged
merged 9 commits into from
Oct 27, 2021

Conversation

mperrotti
Copy link
Contributor

@mperrotti mperrotti commented Oct 19, 2021

Screenshots

Screen.Recording.10-19-2021.at.2.27.PM.mp4

Merge checklist

  • 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 October 19, 2021 18:47
@changeset-bot
Copy link

changeset-bot bot commented Oct 19, 2021

🦋 Changeset detected

Latest commit: 73a3caf

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

This PR includes changesets to release 1 package
Name Type
@primer/components Minor

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 Oct 19, 2021

size-limit report 📦

Path Size
dist/browser.esm.js 54.2 KB (+0.28% 🔺)
dist/browser.umd.js 54.6 KB (+0.29% 🔺)

@mperrotti
Copy link
Contributor Author

The snapshots that are failing in this branch are also failing on main

@@ -172,6 +210,16 @@ function TextInputWithTokensInnerComponent<TokenComponentType extends AnyReactCo
}
}

const focusInput: MouseEventHandler = () => {
combinedInputRef.current?.focus()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes sure the actual <input /> gets focus no matter where in the in the input wrapper the user clicks (except for clicking on tokens)

@@ -29,6 +29,18 @@ const LabelledTextInputWithTokens: React.FC<TextInputWithTokensProps> = ({onToke
</>
)

// describe('axe test', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you planning to uncomment this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops - yes!

for (const tokenLabel of allTokenLabels) {
const tokenNode = getByText(tokenLabel)
expect(tokenNode).toBeDefined()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for always writing such thorough tests ❤️

Copy link
Contributor

@colebemis colebemis left a comment

Choose a reason for hiding this comment

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

💖

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.

2 participants