Skip to content

Conversation

Antoliny0919
Copy link
Contributor

Trac ticket number

ticket-34041

Branch description

Continue farita1699's PR

I have improved the accessibility of the breadcrumb area in the admin page as follows.

  1. I updated the breadcrumb links to be structured as <li> items within an <ol> list.

This change allows screen reader users to know how many items are present in the breadcrumbs area.

Screenshot 2025-05-22 at 4 20 28 PM
  1. I added aria-current="page" to the element representing the current page in the breadcrumb area.

This change allows screen reader users to identify the current page by announcing it as the "current page" when navigating to the corresponding breadcrumb item.

Screenshot 2025-05-22 at 4 27 14 PM
  1. I added an tag to the last item in the breadcrumbs.

This change makes the last breadcrumb item accessible via the "Tab key" when using a screen reader.

Checklist

  • This PR targets the main branch.
  • The commit message is written in past tense, mentions the ticket number, and ends with a period.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.
  • I have added or updated relevant docs, including release notes if applicable.
  • I have attached screenshots in both light and dark modes for any UI changes.

Comment on lines 733 to 753
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the last breadcrumb item was changed to an tag, it now has an underline.
Should we remove the underline?
(The ticket mentioned that the existing design should be preserved as is.)
Additionally, removing the underline would likely require a selector with higher specificity. 🥲

Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I understand the ticket, yes, the underline should be removed. There doesn't seem to be a utility class for that in the CSS so far, so you have to add something like:

.nolink {
   color: inherit !Important;
   text-decoration: none !Important;
}

Comment on lines 5 to 10
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In admin-doc, there is no page like template_index for templates.
Therefore, when accessing the detail page, I set the href of the breadcrumb item labeled "template" to an empty string ("").
Is there a better way to handle this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about providing the breadcrumb separator "›" using CSS content?
If the separator is added via CSS content, screen readers won’t focus on elements like "›", which might improve accessibility.

Screenshot 2025-05-22 at 4 42 44 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

The relevant example in ATAG also recommends to use CSS for this. However, I think CSS content will still show up in the accessibility tree. So maybe you have to use borders instead? I am not sure about this though, better test with a screen reader.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I saw this implemented with CSS on another site and tested it with a screen reader.
I'll try applying it myself and test it with a screen reader as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found that when the ">" is implemented using content, it is accessible to screen readers. 😥
However, when content is used to render an image and a size is specified inside the content, screen readers do not recognize it.
If we actually want to apply this, using the mask property would allow for color customization as well.

Choose a reason for hiding this comment

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

You can add an alternative text to CSS-generated content. Since here it's decorative, the alternative should be empty. Like this:

.myclass::after {
    content: ">" / "";
}

Copy link
Contributor Author

@Antoliny0919 Antoliny0919 left a comment

Choose a reason for hiding this comment

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

I've left comments on a few parts where I had difficulty making decisions...

@Antoliny0919
Copy link
Contributor Author

Could you please review this work? @tut-tuuut 🥰

@tut-tuuut
Copy link

ooops sorry I did not see the mention, I will review soon!

@xi
Copy link
Contributor

xi commented May 28, 2025

I notice you used an unordered list <ul> while both the ticket and ATAG call for an ordered list <ol>. Was that an intentional change?

@Antoliny0919
Copy link
Contributor Author

Antoliny0919 commented May 28, 2025

I notice you used an unordered list <ul> while both the ticket and ATAG call for an ordered list <ol>. Was that an intentional change?

Thank you for the review @xi . I agree that using

    is definitely more appropriate for breadcrumbs. I hadn’t realized this part, that’s a great point. Thank you!

@Antoliny0919
Copy link
Contributor Author

Using ">" as CSS content also resolves the issue where it was previously displayed incorrectly in RTL mode. 🙌🙌

Before

Screenshot 2025-06-18 at 4 29 44 PM

After

Screenshot 2025-06-18 at 4 36 08 PM

Choose a reason for hiding this comment

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

Adding alternative to hide the decoration from screen readers:

Suggested change
content: ' \203A ';
content: ' \203A ' / '';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice, I didn’t know this approach, now screen readers no longer access unnecessary elements like ">" !

@sarahboyce sarahboyce added selenium Apply to have Selenium tests run on a PR screenshots 🖼️ labels Jun 24, 2025
Copy link
Contributor

@sarahboyce sarahboyce 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!
I think django/contrib/admin/templates/registration/logged_out.html still needs updating 👍

nitpick, make sure commit messages are in past tense (see https://docs.djangoproject.com/en/5.2/internals/contributing/committing-code/#committing-guidelines)

Comment on lines 741 to 749
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can also use the css for aria-current=page rather than last child logic here

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<li><a href="" aria-current="page">{% translate 'Server error' %}</a></li>
<li><a href="#" aria-current="page">{% translate 'Server error' %}</a></li>

I think hashes are better to prevent a page reload on click

Copy link
Contributor Author

@Antoliny0919 Antoliny0919 Jun 25, 2025

Choose a reason for hiding this comment

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

I referred to @thibaudcolas comment from the previous PR regarding this part.
I also agree that using # has its advantages.
Instead of changing the href, how about keeping it as is and applying pointer-events: none?
That way, regular users won’t experience any change on click, but screen reader users can still access the link via keyboard (tab).
What do you think about this approach?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

++ This change would also include pagination ...

Copy link
Contributor

Choose a reason for hiding this comment

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

What you have currently is aligned with https://www.w3.org/WAI/ARIA/apg/patterns/breadcrumb/examples/breadcrumb/ , so I think you're correct to use href="" and I don't think an update of css is needed 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I’ve reverted the CSS back to its original state.

Copy link
Contributor

@sarahboyce sarahboyce 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 for the updates @Antoliny0919
This looks good to me

Unfortunately the screen readers I test with do not support the aria-current attribute (https://a11ysupport.io/tech/aria/aria-current_attribute Narrator/Orca). This will need testing and approval from an accessibility team member 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
screenshots 🖼️ selenium Apply to have Selenium tests run on a PR
Projects
Status: To Review
Development

Successfully merging this pull request may close these issues.

4 participants