-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Improving Related Posts markup as a follow up to jetpack PR 11324 #31023
Conversation
height="24" | ||
viewBox="0 0 24 24" | ||
> | ||
<title>{ __( 'Icon for image' ) }</title> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this wasn't introduced in this PR, but noting that title
is basically ignored by screen readers because SVG
component hides the whole icon from screen readers with these props:
'aria-hidden': 'true',
focusable: 'false',
Not a blocker for this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is why there is an aria-label
in the figure
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure but isn't <title>
still redundant? 🙃
<svg aria-hidden>
<title>...</title>
</svg>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the Svg
component in Gutenberg takes care of the aria-hidden
and focusable
stuff automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, so that's what I meant to say that <title>
isn't needed here at all, because SVG
component adds aria-hidden
automatically and thus screen readers will never actually read that title
. Unless I'm missing something? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In summary, this seems redundant.
<title>{ __( 'Icon for image' ) }</title> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, but it annoys the linter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused, which linter/rule? 🙃
cb8d289
to
276d15f
Compare
@@ -17,95 +17,92 @@ export const MAX_POSTS_TO_SHOW = 6; | |||
|
|||
function PlaceholderPostEdit( props ) { | |||
return ( | |||
<div | |||
<ul |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting that since different themes introduce padding/margin to ul
and li
elements, would be good to make sure we reset them so not to have surprises.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an !important
statement in the Sass code that should cover this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we increase specifity in some other way than by using !important
which is often a difficult pattern otherwise (https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity)? We just had a similar case with slideshow block #31019
Not a blocker for this PR tho!
{ __( 'Preview: Not enough related posts found' ) } | ||
</strong> | ||
<li className="jp-related-posts-i2__post-link"> | ||
<a id={ props.id + '-heading' } href={ window.location }> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to guard against window
not existing — this can happen e.g. in our testing setups.
Basically just;
typeof window !== 'undefined'
Are you targetting this for 7.1? I was hesitant to add milestone if not. |
@simison — Yes — This need to make it in to 7.1. |
276d15f
to
7a3fe93
Compare
className="jp-related-posts-i2__post-image-placeholder-figure-square" | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="100%" | ||
height="100%" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe 100%
are valid values for width and height attributes. They should be integers representing a value in CSS pixels.
https://html.spec.whatwg.org/#dimension-attributes
Styling of this type should be handled by CSS.
height="24" | ||
viewBox="0 0 24 24" | ||
> | ||
<title>{ __( 'Icon for image' ) }</title> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In summary, this seems redundant.
<title>{ __( 'Icon for image' ) }</title> |
@@ -17,95 +17,95 @@ export const MAX_POSTS_TO_SHOW = 6; | |||
|
|||
function PlaceholderPostEdit( props ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoa, there are 4 components defined in this file! I strongly prefer 1 component 1 file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are all dependencies of a master component.
7a3fe93
to
7155cbe
Compare
Changes proposed in this Pull Request
has-small-font-size
classes from some HTML elements as this was causing a discrepancy between the editor (where this is defined) and the fronted, where is depends on the theme.Testing instructions
Test with various themes. Does anything break?