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

Preview menu: Remove redundant "opens in a new tab" hidden text #24427

Merged

Conversation

kellychoffman
Copy link
Contributor

@kellychoffman kellychoffman commented Aug 6, 2020

Fixes: #24386

Text link already states that the link will open in a new tab, so this PR removes the visually hidden "(opens in a new tab)" text. (And yes, I realize this very description is redundant if you've read the title)

@annezazu annezazu added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository labels Aug 6, 2020
@shaunandrews shaunandrews added First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository and removed First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository labels Aug 6, 2020
@jasmussen jasmussen self-requested a review August 7, 2020 07:21
Copy link
Contributor

@jasmussen jasmussen left a comment

Choose a reason for hiding this comment

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

Before:

Screenshot 2020-08-07 at 09 21 17

After:

Screenshot 2020-08-07 at 09 20 40

Congrats on your first PR!

The test failure looks legitimate, I'll take a look and see if I can fix it.

@jasmussen
Copy link
Contributor

It looks like the snapshots just needed updating. Usually whenever the markup of the UI changes, these need updating. I do it on the commandline using npm run test-unit -- --updateSnapshot, but I'm always happy to take a look.

@@ -207,12 +207,6 @@ export class PostPreviewButton extends Component {
{ this.props.textContent
? this.props.textContent
: _x( 'Preview', 'imperative verb' ) }
<VisuallyHidden as="span">
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like there are a couple of other uses of PostPreviewButton, like in the PostLockedModal, and I think that only says 'Preview'.

An option could be to change the text everywhere to 'Preview in new tab', or make the VisuallyHidden text something that can be enabled/disabled through a prop..

Copy link
Contributor

Choose a reason for hiding this comment

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

Great catch, Probably risky to change that phrasing because it will likely not scale to mobile interfaces with the length of the phrase.

So we should probably restore the hint for that use case.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, this was, in a way, mentioned on the issue:

Looking at the implementation, not sure what is the preferred approach. PostPreviewButton accepts a textContent prop and fallbacks to a link text Preview if none is passed. So the default text does need the visually hidden text, while a more meaningful text passed via textContent may not need it. Since this depends on the actual text passed via the prop, I'd tend to think the behavior can't be automated and maybe an additional, explicit, prop to render the visually hidden text would be the best option.

@kellychoffman
Copy link
Contributor Author

It looks like the snapshots just needed updating

Thanks! TIL.

@jasmussen
Copy link
Contributor

I tried a thing in 34a2d98, to simply make the VisuallyHidden component part of the same condition that outputs the short verb. @talldan can you sanity check it?

@talldan
Copy link
Contributor

talldan commented Aug 13, 2020

@jasmussen Looks good! I'm not sure what that change in the unrelated snapshot file is though:
packages/dependency-extraction-webpack-plugin/test/snapshots/build.js.snap

@jasmussen
Copy link
Contributor

Thanks for looking. That's curious indeed, I didn't even notice it. I'll try a good rebase and regenerate the snaps afterwards. Happy to know the fix is okay though 👍

@jasmussen jasmussen force-pushed the update/remove-preview-tab-redundancy branch from 29c4957 to 266afc2 Compare August 13, 2020 11:30
@jasmussen
Copy link
Contributor

I rebased, which removed the snapshots discrepancy.

I am however seeing a test failure locally, both on this branch and in master, that seems unrelated to this PR but might nonetheless cause tests to fail here:

Summary of all failing tests
 FAIL  packages/components/src/tooltip/test/index.js
  ● Tooltip › #render() › should ignore mouseenter on disabled elements

    expect(jest.fn()).not.toHaveBeenCalled()

    Expected number of calls: 0

@jasmussen
Copy link
Contributor

Hooray, tests are passing!

@jasmussen
Copy link
Contributor

Congrats on your first PR here, Kelly, and thank you!

@jasmussen jasmussen merged commit 3fc4ddb into WordPress:master Aug 14, 2020
@github-actions
Copy link

Congratulations on your first merged pull request, @kellychoffman! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added this to the Gutenberg 8.8 milestone Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preview menu: the link text "Preview in new tab (opens in a new tab)" is redundant
6 participants