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

Organize sliders into expandable summary, add first party protections section #2748

Merged
merged 52 commits into from
May 14, 2021

Conversation

ablanathtanalba
Copy link
Contributor

@ablanathtanalba ablanathtanalba commented Mar 10, 2021

Fixes #2482.

Should help with #2021, and with the problem of users not noticing the "Disable for this site" button.

adds the following sections to the popup:

  • firstparty notifications for when the current site has any unique firstparty protections protections scripts happening on it
  • blocked resources container hidden by default behind the current ’n potential trackers blocked’ message

each of the sections have the option to drop down expand into a more detailed informational or control panel for each:

  • The firstparty section just drops down into a message that describes the type of protection that is taking place, and links to reading more about link tracking and how privacy badger protects against it.
  • The blocked resources hidden under the ’n potential trackers blocked’ message is the same blocked resources container the the current popup shows, with the sliders for each.

EDIT: Widget section forthcoming in #2758

@ablanathtanalba

This comment has been minimized.

@ghostwords

This comment has been minimized.

@ablanathtanalba
Copy link
Contributor Author

Surely there's a more graceful approach to some of my css in this, but going ahead and marking ready for review now. 😅

@ablanathtanalba ablanathtanalba marked this pull request as ready for review March 29, 2021 17:23
@ablanathtanalba ablanathtanalba added translations ui User interface modifications; related to but not the same as the "ux" label labels Mar 29, 2021
Copy link
Member

@ghostwords ghostwords left a comment

Choose a reason for hiding this comment

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

Thank you! Please see my first pass feedback below.

src/js/popup.js Outdated Show resolved Hide resolved
src/js/popup.js Outdated Show resolved Hide resolved
src/js/popup.js Outdated Show resolved Hide resolved
src/js/popup.js Outdated Show resolved Hide resolved
src/js/popup.js Outdated Show resolved Hide resolved
@@ -128,11 +128,24 @@ <h2 id="title-name"><span class="i18n_name"></span></h2>
<span class="i18n_popup_instructions_no_trackers" data-i18n_contents_placeholders="<a target='_blank' title='i18n_what_is_a_tracker' class='tooltip' href='https://privacybadger.org/#What-is-a-third-party-tracker'>"></span>
<span id="no-third-parties" class="i18n_popup_blocked" style="display:none"></span>
</span>
<div id="toggle-blocked-resources-container">
<span id="expand-blocked-resources" class="ui-icon ui-icon-caret-d"></span>
Copy link
Member

Choose a reason for hiding this comment

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

This caret is visible on pages with no third parties (https://example.com).

Copy link
Member

Choose a reason for hiding this comment

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

All carets should get the hand cursor like other clickable elements.

Copy link
Member

Choose a reason for hiding this comment

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

Should carets get a tooltip? "Click to show more information"?

Copy link
Member

Choose a reason for hiding this comment

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

Whatever ends up being clickable to expand/collapse sections should be keyboard-accessible. Users should be able to Tab to visibly select each toggle element and Space (or whatever the standard key is) to activate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved all these except the accessible activation via the keyboard bit. At its current working state, one can focus on the element from the keyboard, but I'm unable to get the activation bit working. I tried attaching on keydown listeners and more tradition onClicks to it, no luck. On the other hand, while testing this out I realized there are a few places that aren't accessible or end up "trapping" the user into some modals that they can't easily exit out of without a mouse action. Perhaps that's worth addressing in a follow up PR?

Copy link
Member

@ghostwords ghostwords Apr 28, 2021

Choose a reason for hiding this comment

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

<div> or <span> elements don't have built-in keyboard accessibility; <a> and <button> elements do.

To make a <span> focusable and so able to receive keyboard events, you have to add a tabindex=0. You then have to add a keydown listener and filter for supported keys.

Make sure to add the tabindex attribute to the same element that your keydown listener is on.

Copy link
Member

Choose a reason for hiding this comment

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

You'll also want to add proper ARIA attributes (such as role=button perhaps) to your elements.

Copy link
Member

@ghostwords ghostwords Apr 28, 2021

Choose a reason for hiding this comment

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

You could instead use a <button> or an <a href="" role="button"> element, which automatically supports keyboard navigation and will also trigger your click handler on Space/Enter presses. You will probably want to e.preventDefault() inside the click handler (to avoid performing the unwanted default action of <a>).

Copy link
Member

Choose a reason for hiding this comment

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

Yes to improving keyboard navigation in a followup PR: #2629 (comment)

src/skin/popup.html Outdated Show resolved Hide resolved
src/skin/popup.css Outdated Show resolved Hide resolved
src/js/popup.js Outdated Show resolved Hide resolved
src/js/webrequest.js Outdated Show resolved Hide resolved
src/js/webrequest.js Outdated Show resolved Hide resolved
@ghostwords ghostwords changed the title Display different protections types in popup Organize sliders into expandable summary, add first party protections section Apr 8, 2021
Friendlier to translators and easier to update the link in the future
(avoids having to "retranslate" every message).
More logical for translators: in the UI the header comes first,
before the "more info" text.
Also:

- Link tracking protection moved above sliders
- Keyboard support
- Dark mode styles
- RTL locale support
src/js/utils.js Outdated Show resolved Hide resolved
src/js/utils.js Outdated Show resolved Hide resolved
@ablanathtanalba
Copy link
Contributor Author

The tweaks you left @ghostwords look good! I like the styling you added too, with the orange outline and expanding animation

src/js/utils.js Outdated Show resolved Hide resolved
@ghostwords ghostwords merged commit 6d9eedc into master May 14, 2021
@ghostwords ghostwords deleted the more_expressive_popup branch May 14, 2021 17:40
ghostwords added a commit that referenced this pull request May 17, 2021
Following up on #2748
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
translations ui User interface modifications; related to but not the same as the "ux" label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Indicate when first-party protections are active
3 participants