-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an icon and visually hidden a11y text to links that open in a new…
… tab (#7883) Adds an icon and the visually hidden text '(Opens in a new window)' for improved a11y to two links that open in a new tab. - Use `ExternalLink` component for the link editor toolbar option on the Paragraph block. It replaces an `a` tag. This adds an additional icon and the visibly hidden text to the url. - Use the `ExternalLink` component for the permalink url when editing the post header Furthermore a change has been made to the preview button in the top toolbar so that is a button element instead of an anchor. * Use ExternalLink for link in editor toolbar for Paragraph block Links added in Paragraph are opened in a new tab when using the editor toolbar. This commit switches the anchor tag with an ExternalLink component. This makes the link more accessible (it adds some hidden text) and provides an icon indicating that the link is external. * Specify PostPreviewButton as opening external links * Fix overly specific selector preventing override of icon styles * Fix incorrect default display property given to button * Make post preview button render as a button instead of a link For accessibility purposes the post preview button is now rendered as a button, meaning it can be interacted with using the keyboard (space bar to open a preview page). * Make the post permalink link an ExternalLink instead of a Button * Rename member variable used as ref to reflect that it's no longer a button * Modify ExternalLink component to forwards its ref * Adjust styling to work in a wider range of contexts
- Loading branch information
Showing
9 changed files
with
59 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ | |
display: none; | ||
|
||
@include break-small { | ||
display: inline-block; | ||
display: inline-flex; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
editor/components/post-preview-button/test/__snapshots__/index.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`PostPreviewButton render() should match the snapshot 1`] = ` | ||
<Button | ||
className="editor-post-preview" | ||
disabled={false} | ||
isLarge={true} | ||
onClick={[Function]} | ||
> | ||
Preview | ||
<WithSafeTimeout(WithSelect(WithDispatch(DotTip))) | ||
id="core/editor.preview" | ||
> | ||
Click ‘Preview’ to load a preview of this page, so you can make sure you’re happy with your blocks. | ||
</WithSafeTimeout(WithSelect(WithDispatch(DotTip)))> | ||
</Button> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
.components-external-link { | ||
.dashicon { | ||
width: 1.4em; | ||
height: 1.4em; | ||
margin: 0 .2em; | ||
vertical-align: top; | ||
} | ||
} | ||
.components-external-link__icon { | ||
width: 1.4em; | ||
height: 1.4em; | ||
margin: -0.2em 0.1em 0; | ||
vertical-align: middle; | ||
} |