Skip to content

Improve meaningful sequence in report/around page #5354

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

lucascumsille
Copy link
Contributor

@lucascumsille lucascumsille commented Feb 5, 2025

Fixes: https://github.com/mysociety/societyworks/issues/4560

Replaces: #5208

Unlike the previous PR#5208 I thought that a better approach to include the icons would be to use HTML templates instead of copy and pasting the SVG. See commit here

Preview

Screen.Recording.2025-02-06.at.07.01.49.mov

Preview Mobile

Screen.Recording.2025-02-06.at.07.03.19.mov

Pending from PR #5208

This template seems very similar to the non-mobile one, I can combine them later.
#5208 (comment)

  • templates/web/base/report/display_tools_mobile.html is quite

@lucascumsille lucascumsille force-pushed the 4560-meaningful-sequence-v2 branch from 7219efc to eb3bd29 Compare February 5, 2025 09:50
Copy link

codecov bot commented Feb 5, 2025

Codecov Report

Attention: Patch coverage is 64.28571% with 10 lines in your changes missing coverage. Please review.

Project coverage is 82.29%. Comparing base (0df4ec8) to head (21312a1).

Files with missing lines Patch % Lines
web/cobrands/fixmystreet/fixmystreet.js 64.28% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5354      +/-   ##
==========================================
- Coverage   82.30%   82.29%   -0.01%     
==========================================
  Files         428      428              
  Lines       34057    34075      +18     
  Branches     5511     5511              
==========================================
+ Hits        28029    28041      +12     
- Misses       4397     4403       +6     
  Partials     1631     1631              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lucascumsille lucascumsille force-pushed the 4560-meaningful-sequence-v2 branch from eb3bd29 to a22092c Compare February 5, 2025 10:12
@lucascumsille
Copy link
Contributor Author

lucascumsille commented Feb 5, 2025

A couple of notes from the previous PR:
#5208

if ($('#key-tools-mobile a.js-feed').length) {

This change shouldn't be made - the js-feed is still in key-tools on any page it is used (not a report page), and needs to moved from there to sub_map_links.
And I'm afraid that sub_map_links uses a background image, so you then end up with two RSS feed icons being shown.
#5208 (comment)

I solved this issue in this PR. See here:

Screenshot 2025-02-05 at 10 18 22

@lucascumsille lucascumsille force-pushed the 4560-meaningful-sequence-v2 branch from 85e4c8d to 6360815 Compare February 5, 2025 10:53
@lucascumsille lucascumsille marked this pull request as ready for review February 6, 2025 07:19
@lucascumsille lucascumsille requested a review from dracos February 6, 2025 07:19
@lucascumsille
Copy link
Contributor Author

lucascumsille commented Feb 6, 2025

@dracos I made the changes requested in #5208 so I split the commits into 4:

1.A commit to switch from external to inline SVGs, no other changes (that would also involve e.g. fixing the issue where the Feed link is moved to sub_map_links).
2.A commit to add the close button to the small drawer (and anything else related to that, but nothing more).
3.The skip button on around page if needed.
4.Changes to have a separate key-tools for desktop than mobile (fixing the issue with placement, not working for non-staff, etc)

In the review I included the latest comments you left in #5208

@lizettal
Copy link
Contributor

lizettal commented Apr 8, 2025

@dracos I think this is still with you for review. Could you please review this before you go on leave so we can try and get this wrapped up in the coming sprint.

This change will make it easier to control the icon size by passing it
as an argument. It will also minimise issues with passing the contrast
test, where currently the sprite has a fixed colour that doesn't
necessarily pass the contrast test, and it's quite hard to read against
light backgrounds. Now, the icons use currentColor, so it inherits the
value of the parent.
- Added aria-expanded.
- Increase visibility of the drawer on mobile by moving it to the top of
  the screen.
- Added close button to drawer.
- If drawer is opened using keyboard then the focus jumps to the first
  element inside the drawer.
Copy link
Member

@dracos dracos left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for tidying and making all those changes :) I think the display_tools_mobile template can include the other SVG templates you changed the main template to use, and I had one question about when the buttons are hidden on mobile.
The browser tests fail a lot, I assume due to where things have moved to so that will need looking at, I can take a look at some of them if time later today.


#key-tools {
html.js & {
display: none;
Copy link
Member

Choose a reason for hiding this comment

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

Why are the desktop buttons only hidden if JS is enabled? It means both sets of buttons are shown if JS isn't working - is there an issue with always hiding them, does something go wrong?

<li><form method="post" action="/report/[% problem.id %]/delete" id="remove-from-site-form">
<input type="hidden" name="token" value="[% csrf_token %]">
<button type="submit" id="key-tool-report-abuse" class="has-inline-svg has-inline-svg--column-wrap" data-confirm="[% loc('Are you sure?') %]" name="remove_from_site">
<svg role="presentation" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path fill="currentColor" d="M12.866 3l9.526 16.5a1 1 0 0 1-.866 1.5H2.474a1 1 0 0 1-.866-1.5L11.134 3a1 1 0 0 1 1.732 0zM11 16v2h2v-2h-2zm0-7v5h2V9h-2z"/></svg>
Copy link
Member

Choose a reason for hiding this comment

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

This template could use the same icons/ templates I think? The contents of the SVGs look the same.

Copy link
Member

Choose a reason for hiding this comment

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

(Then, if all that's different then is the order of the text and the SVG, can flex order fix that? Then they could share more of the same template for the list items themselves.)

@dracos dracos force-pushed the 4560-meaningful-sequence-v2 branch from 6360815 to 47e8f90 Compare April 10, 2025 12:32
@@ -0,0 +1,43 @@
<div class="shadow-wrap">
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, one more thing - this file has some IDs in that are duplicating the ones in display_tools.html. I see you fixed the ones that you were then using in the JS, but the others will need fixing too - e.g. key-tool-report-abuse (not used at all, can be removed), key-tool-problems-nearby (does have some uses), and remove-from-site-form (not needed at all?)

This allows it more easily to appear in a
better place on mobile from desktop.
This commit should minimise the confusion for assistive device users.
Currently, the way components are presented and the focus order is not
linear; after they have travelled through the map, they are presented
with the 'Can't use the map?' link and then go directly to the
`#key-tools` component sitting at the bottom of the page, skipping the
filters and report list. To respect the page sequence, the user should
go directly to the report filter and then to the report list. The
downside of this approach is that users who want to use the #key-tools
would have to jump through a whole list of reports before being able to
get to the #key-tools. The solution in this commit is to add a link
right after the 'Can't use the map?' that gives the user some context
about the mismatch between the reading sequence and also the opportunity
to skip the #key-tools in case they just want to jump the next element
which would be the report filters.
@dracos dracos force-pushed the 4560-meaningful-sequence-v2 branch from 47e8f90 to 21312a1 Compare April 10, 2025 12:52
@dracos
Copy link
Member

dracos commented Apr 10, 2025

I've hopefully patched the commit so that the Cypress tests are passing again (they were getting confused now there were two key tools blocks in the source). So just the small issues above :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants