-
Notifications
You must be signed in to change notification settings - Fork 382
Improve Sandboxing info in AMP admin bar menu item #6767
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
Conversation
Plugin builds for 0bb2081 are ready 🛎️!
|
$amp_link->appendChild( $dom->createTextNode( ' ' ) ); | ||
$span->textContent = $text; | ||
$span->setAttribute( Attribute::TITLE, $title ); | ||
$amp_link->appendChild( $span ); |
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 this be reordered?
Lines 273 to 277 in 21412aa
$span = $dom->createElement( Tag::SPAN ); | |
$amp_link->appendChild( $dom->createTextNode( ' ' ) ); | |
$span->textContent = $text; | |
$span->setAttribute( Attribute::TITLE, $title ); | |
$amp_link->appendChild( $span ); |
To something like:
$span = $dom->createElement( Tag::SPAN );
$span->textContent = $text;
$span->setAttribute( Attribute::TITLE, $title );
$amp_link->appendChild( $dom->createTextNode( ' ' ) );
$amp_link->appendChild( $span );
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.
Yeah, except let's put the setAttribute call before textContent assignment. Then we don't have to align the equals signs 😊
Can you make your change an actual GitHub suggestion?
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.
Can you make your change an actual GitHub suggestion?
Looks like you were faster 😁
); | ||
} | ||
$link->textContent = $title; | ||
$level_li->appendChild( $link ); |
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.
If current user does not have manage_options
capabilities, link href
attribute will be empty:
- do we want to display "sandboxing level" information to users that does not have rights to manage site options?
- if yes, could this be displayed in
<span>
element instead of<a>
?
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.
Yeah, I tried a span
at first, but the admin bad styles specifically are targeting an a
here. It would be very unusual for the admin menu item to be shown if the user can't manage_options
anyway, since it's usually bound up with whether a use can do validation. So I'd consider this to just be an edge case.
The sandboxing level is shown in the meta generator tag otherwise, so it's not a problem to show it to users who aren't admins.
Good questions.
Summary
I realized the AMP admin menu item was not entirely clear when the Sandboxing experiment is enabled. I've improved the tooltip for the number emoji and I've added a submenu item which contains the same text, with a link to the Sandboxing drawer on the Settings screen:
Checklist