Skip to content

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

Merged
merged 2 commits into from
Dec 7, 2021

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented Dec 7, 2021

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:

image

Checklist

  • My code is tested and passes existing tests.
  • My code follows the Engineering Guidelines (updates are often made to the guidelines, check it out periodically).

@westonruter westonruter added this to the v2.2 milestone Dec 7, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2021

Plugin builds for 0bb2081 are ready 🛎️!

$amp_link->appendChild( $dom->createTextNode( ' ' ) );
$span->textContent = $text;
$span->setAttribute( Attribute::TITLE, $title );
$amp_link->appendChild( $span );
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be reordered?

amp-wp/src/Sandboxing.php

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 );

Copy link
Member Author

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?

Copy link
Contributor

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 );
Copy link
Contributor

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>?

Copy link
Member Author

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.

@westonruter westonruter merged commit e03f621 into develop Dec 7, 2021
@westonruter westonruter deleted the update/sandboxing-admin-menu-item branch December 7, 2021 20:53
@milindmore22
Copy link
Collaborator

QA Passed

Seen tooltip with Sandboxing level

image

@westonruter westonruter added the Changelogged Whether the issue/PR has been added to release notes. label Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelogged Whether the issue/PR has been added to release notes. Sandboxing Experiment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants