8000 Fixed #34917 -- Underlined the 'a' tags in the main content area of the admin. by Antoliny0919 · Pull Request #18958 · django/django · GitHub
[go: up one dir, main page]

Skip to content

Fixed #34917 -- Underlined the 'a' tags in the main content area of the admin. #18958

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 1 commit into from
Mar 27, 2025

Conversation

Antoliny0919
Copy link
Contributor
@Antoliny0919 Antoliny0919 commented Dec 21, 2024

Trac ticket number

ticket-34917

Branch description

Continue @Myrausman's PR
Add underline to "a" tags "main content area" in the Django admin.

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.

@Antoliny0919
Copy link
Contributor Author
Antoliny0919 commented Dec 21, 2024

The added underline part...

Login

Screenshot 2025-01-23 at 5 33 38 PM

Logout

Screenshot 2025-01-23 at 5 33 56 PM

Password Reset Done

Screenshot 2025-01-23 at 5 34 30 PM

List Display

Screenshot 2025-01-23 at 5 36 34 PM

Filter

Screenshot 2025-01-23 at 5 37 00 PM

Add/Change Form Fields

change_form_underline

Tabular/Stacked Inline

tabular_inline_underline

Message

admin_message

Breadcrumbs

Screenshot 2025-01-31 at 10 16 39 AM

Recent Actions

Screenshot 2025-01-31 at 10 17 19 AM

@Antoliny0919
Copy link
Contributor Author
Antoliny0919 commented Dec 25, 2024

Could you give me some suggest on a few things? 🧐

  1. The tags on the Logout and Password Reset Done pages do not have specific identifiers, so it's difficult to add CSS to them without affecting other parts of the page outside the "main content area." Do you think I should add specific class or id to these tags?
  2. Should I add the underline CSS directly to the tags that need it, or should I add the underline to all tags inside the "main content area" and then exclude the ones that don’t need it? If I add the underline only to the specific tags that need it, the accuracy will be higher, but there's a risk that I might miss some links that need an underline. On the other hand, if I add the underline to all tags within the "main content area," I'm concerned that there might be some links where an underline is not needed but would still be applied.

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 @Antoliny0919

I've added a suggestion which I hope will address your questions above 👍

@knyghty knyghty requested a review from a team January 22, 2025 16:59
@Antoliny0919 Antoliny0919 force-pushed the ticket_34917 branch 2 times, most recently from 3cecb5e to bd79d5e Compare January 23, 2025 09:40
@Antoliny0919
Copy link
Contributor Author

#18958 (comment)

Here is the part where the underline has been added. Please let me know if anything is missing or unnecessary!

@Antoliny0919
Copy link
Contributor Author
Screenshot 2025-01-23 at 7 16 56 PM

Should we also add an underline to the message? For now, I’ve left it without one.

@knyghty
Copy link
Member
knyghty commented Jan 23, 2025

I think underlining links in messages would be good, especially as the contrast could be a bit lacking depending on the background colour for each message level

@Antoliny0919
Copy link
Contributor Author

I think underlining links in messages would be good, especially as the contrast could be a bit lacking depending on the background colour for each message level

I agree as well. Since there is a background color, I feel like this might be the most necessary part.

@Antoliny0919 Antoliny0919 changed the title Fixed #34917 -- Underlined Links in Django Admin. Fixed #34917 -- Add an underline to the 'a' tags in the main content area of the admin. Jan 23, 2025
@sarahboyce sarahboyce changed the title Fixed #34917 -- Add an underline to the 'a' tags in the main content area of the admin. Fixed #34917 -- Underlined the 'a' tags in the main content area of the admin. Jan 30, 2025
@@ -887,6 +891,10 @@ a.deletelink:focus, a.deletelink:hover {
width: 100%;
}

#content-main:not(.app-list) a:not([role="button"]) {
Copy link
Contributor
@sarahboyce sarahboyce Jan 30, 2025

Choose a reason for hiding this comment

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

Suggested change
#content-main:not(.app-list) a:not([role="button"]) {
a:not(#nav-sidebar a):not(#content-main.app-list a):not([role="button"]) {

I think maybe we can do this and then remove the other css rule and the <div id="content-main"> additions.
Part of the reason is I feel like the breadcrumbs and the recent actions section should also have underlines 🤔

After that, I think we're just missing a review from the accessibility team and we need to update the screenshots of the admin in the docs

Copy link
Contributor Author
@Antoliny0919 Antoliny0919 Jan 31, 2025

Choose a reason for hiding this comment

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

Thank you for the great suggestion, @sarahboyce 😃

Hmm... I'm not sure if breadcrumbs really need underlines. Since breadcrumbs are already designed in a very intuitive way, I believe users can easily recognize them as links without the need for underlines.
(Considering that the target users are developers with some knowledge of the web...)
Or maybe it would be good to add a --header-link-color underline to the breadcrumbs, similar to the one applied to user-tools.
Screenshot 2025-01-31 at 10 06 03 AM

For now, I'll follow your suggestion and add underlines to both the breadcrumbs and recent actions.

Additionally, links are also being added to the header, which I assume was unexpected.
Screenshot 2025-01-31 at 10 03 20 AM
So, I'll exclude the links in the header and apply the following selectors instead.

a:not(
    [role="button"],
    #header a,
    #nav-sidebar a,
    #content-main.app-list a
) {
    text-decoration: underline;
}

Copy link
Member

Choose a reason for hiding this comment

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

I don't have a strong opinion on the breadcumb underlines - maybe I'd weakly prefer it.

But one thing to keep in mind is that the admin isn't only used by developers, it's also used a lot by customer support, operations and all sorts of people in early stage (and later) companies that haven't built their own admin yet (or never will), and I've also seen this with agencies giving the site owner who knows more or less nothing access and a bit of training to make changes to the site.

@Antoliny0919 Antoliny0919 force-pushed the ticket_34917 branch 2 times, most recently from c2fadf2 to 71127e2 Compare January 31, 2025 04:01
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 updating the screenshots! I think it also helps the review ⭐

@Antoliny0919 Antoliny0919 force-pushed the ticket_34917 branch 3 times, most recently from 53f4bf9 to ad4b62c Compare March 25, 2025 12:43
@sarahboyce
Copy link
Contributor

test_ForeignKey--raw_id_widget--dark

The calendar icon button is no longer visible on dark mode

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.

We're almost there 👍

@Antoliny0919 Antoliny0919 requested a review from sarahboyce March 25, 2025 23:40
@sarahboyce sarahboyce added the selenium Apply to have Selenium tests run on a PR label Mar 26, 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 for the screenshot updates @Antoliny0919 😍
Love that the sizes are much more consistent

Going through the visual regression screenshots and it looks like when the page is first loaded the "Add another ..." button has an underline but then it goes away 🤔
test_added_stacked_inline_with_collapsed_fields--loaded--desktop_size

Copy link
Contributor

Choose a reason for hiding this comment

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

Quoting Tom from the ticket

I think this should ideally exclude the site index and app index pages (they're quite clear), but acceptable if these are underlined as well.

What do we think? These have underlines here but no underlines when within the sidebar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you referring to the recent actions section in the sidebar?

From what I can see in the image, there don’t seem to be any actions related to change or additions, so no links are displayed. But if there were such actions, I believe links with underlines would appear. ☺️

I think this should ideally exclude the site index and app index pages (they're quite clear), but acceptable if these are underlined as well.

This part feels quite challenging...

Thinking back to the discussions we had on Discord about this change, underlines were a feature that people had mixed opinions about.

Personally, I also think the index page and app index page elements are clear enough without underlines (though this might just be my personal opinion).

So, even if it slightly affects consistency, I’d lean towards excluding underlines from the links on the index and app index pages.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I think what you have code wise is correct, but this screenshot is wrong. I don't think you need to update this screenshot at all

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry about that. I was confused as well 🥲

Copy link
Contributor

Choose a reason for hiding this comment

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

This is also outdated, I think we can revert this change

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 pushed minor tweaks 👍

@sarahboyce sarahboyce merged commit 849f830 into django:main Mar 27, 2025
32 checks passed
@github-project-automation github-project-automation bot moved this from In Progress / Review to Done in django accessibility improvements Mar 27, 2025
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
Development

Successfully merging this pull request may close these issues.

5 participants
0