티스토리 수익 글 보기

티스토리 수익 글 보기

Refs #34038 — Improve link readability and identifiability by yushanfans2233 · Pull Request #17419 · django/django · GitHub
Skip to content

Conversation

yushanfans2233
Copy link

Light

Before

before-light

After

after-light

Dark

Before

before-dark

After

after-dark

@felixxm felixxm requested a review from a team October 28, 2023 05:44
@felixxm felixxm changed the title Fixed #34038 — Improve link readability and identifiability Refs #34038 — Improve link readability and identifiability Oct 28, 2023
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello! Thank you for your contribution 💪

As it’s your first contribution be sure to check out the patch review checklist.

If you’re fixing a ticket from Trac make sure to set the “Has patch” flag and include a link to this PR in the ticket!

If you have any design or process questions then you can ask in the Django forum.

Welcome aboard ⛵️!

@github-actions
Copy link

github-actions bot commented Oct 28, 2023

🖼️ Screenshots created

You can download the generated screenshots from the workflow artifacts.

Please note that artifacts are only available for download for 90 days.

  • Generated screenshots for 2d48d9f at Sat Oct 28 08:02:52 UTC 2023 (download).
  • Generated screenshots for d49cf8b at Sat Oct 28 09:59:55 UTC 2023 (download).
  • Generated screenshots for cfc9a2a at Sun Nov 5 12:49:23 UTC 2023 (download).
  • Generated screenshots for e39473f at Tue Nov 7 14:45:20 UTC 2023 (download).

@sarahboyce
Copy link
Contributor

sarahboyce commented Oct 28, 2023

Thank you for this! If you like, you can add a screenshot within the test_user_change_password test (something like self.take_screenshot("user_change")) which will also add this page with light dark mode etc in our tests 👍

@yushanfans2233
Copy link
Author

@sarahboyce done, PTAL 😄

@sarahboyce
Copy link
Contributor

Thank you @yushanfans2233! This looks right but for some reason I can’t see another screenshot generated 🤔 can you run the new selenium test with screenshots locally (https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-the-selenium-tests) and see if it created screenshots?

@yushanfans2233
Copy link
Author

I ran the command .\runtests.py --parallel=1 --selenium=chrome --screenshots.
Then I see the following screenshots created:

  • test_user_change_password_dark-user_change.png
  • test_user_change_password_desktop_size-user_change.png
  • test_user_change_password_mobile_size-user_change.png
  • test_user_change_password_rtl-user_change.png

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.

Needs a review from the accessibility team but this looks good to me ⭐

@yushanfans2233
Copy link
Author

Thanks for your help, really appreciate it 😸 .

with self.wait_page_loaded():
self.selenium.get(self.live_server_url + change_url)

self.take_screenshot("user_change")
Copy link
Member

Choose a reason for hiding this comment

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

This test doesn’t have any assertions. Instead I’d add take_screenshot to one of existing tests, e.g. UserAdminTest.test_save_button().

Copy link
Author

Choose a reason for hiding this comment

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

UserAdminTest is not a AdminSeleniumTestCase, I can’t take screenshot in it.

Copy link
Member

@sabderemane sabderemane 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! Thank you for your contribution @yushanfans2233 😄
I just add a comment for the accessibility team

color: var(body-fg);
text-decoration: none;
color: var(link-fg);
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.

@knyghty @thibaudcolas I have one concern about this change, I haven’t tested this change yet and can’t see the screenshot on my phone, but it got me thinking about titles that can also be links, are they also considered underlined or just the content?

Copy link
Member

Choose a reason for hiding this comment

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

As far as I’m aware, all links in the admin will be underlined, so this is a big UI change.

Copy link
Member

@sabderemane sabderemane Oct 30, 2023

Choose a reason for hiding this comment

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

Argh, sorry I should have rephrase, I wanted to say : “do we want them also underlined or just the content?”
I don’t know if it’s already the case according the style, but yes all links in the admin will be underlined as you said, but I think we should agree on what we want before to merge this PR

@knyghty knyghty self-requested a review November 1, 2023 19:08
Copy link
Member

@knyghty knyghty left a comment

Choose a reason for hiding this comment

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

Thanks for the work here, it’s definitely needed. Also sorry for the delay.

Clearly the accessibility of the links in the body is improved. I think we do need some overrides though. The main one is that buttons that act as links are currently underlined, e.g. the “delete” button and the “Add Foo” button on the list page as well as the view on site and history buttons.

There are some where I’m less certain. For example the title text (default “Django administration” probably doesn’t need to be underlined. I’d also argue that the links in the navigation sidebar don’t really need to be underlined, either. But again, interested in a second opinion here.

I also see a link that should be underlined, but isn’t:

Screenshot 2023-11-02 at 17 41 30

I think unrelated to this PR, but I also notice the log out link in the header has a fainter underline than the rest of the links, because it’s using border-bottom rather than text-decoration:

Screenshot 2023-11-02 at 17 46 06

@yushanfans2233
Copy link
Author

Here are two alternative solutions:

Solution 1

Apply an underline and blue color to all <a> tags, and use a CSS class to remove this style from specific locations where it is not needed.

  • Pros: Ensures that no links requiring improvement are missed, even if new ones are added in the future.
  • Cons: May require modifying a significant number of places.

Solution 2

Introduce a new CSS class called .a11y-link and apply it to the links that require improved readability and identifiability.

  • Pros: Provides more precise targeting without affecting existing elements.
  • Cons: There is a potential risk of missing some existing links, as well as future additions, when attempting to identify and modify them all.

@knyghty
Copy link
Member

knyghty commented Nov 3, 2023

@yushanfans2233 personally I’d give option 1 a go. It’s better to accidentally add an underline to something than it is to accidentally forget one, and if there are any they can be fixed over time as they’re noticed.

yushanfans2233 added 2 commits November 5, 2023 20:32
Main points:

1. The <a> element should be colored and underlined to indicate its ability to navigate to a new page or an anchor within the current page.

2.The <a> element, when used as a button or resembling a button, should not be colored and underlined.
@yushanfans2233
Copy link
Author

Hello everyone, I have made some necessary fixes based on the following principles:

  1. To indicate its functionality in navigating to a new page or an anchor within the current page, the <a> element should be styled with color and underlining.

  2. When the <a> element is utilized as a button or appears similar to a button, it should not be styled with color and underlining.

@knyghty knyghty self-requested a review November 5, 2023 12:56
Copy link
Member

@knyghty knyghty left a comment

Choose a reason for hiding this comment

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

One thing I’m not sure about. Maybe it’s fine as it is or maybe not.

At the moment the filters don’t have underline, and the only blue ones are the active filters. Clearly we need to show which filter is active. I’m just not sure which is best. Maybe it’s fine how it is, but it is a bit hard to discern the text there are links.

Screenshot 2023-11-05 at 16 43 58

The Today and Now controls also need something but not sure what. At the moment it’s very unclear you can interact with them. But they don’t really act like links to other pages, they are more like buttons. Again, not sure the best way forward here:

Screenshot 2023-11-05 at 16 47 40

@yushanfans2233
Copy link
Author

One thing I’m not sure about. Maybe it’s fine as it is or maybe not.

At the moment the filters don’t have underline, and the only blue ones are the active filters. Clearly we need to show which filter is active. I’m just not sure which is best. Maybe it’s fine how it is, but it is a bit hard to discern the text there are links.

Screenshot 2023-11-05 at 16 43 58 The Today and Now controls also need _something_ but not sure what. At the moment it’s very unclear you can interact with them. But they don’t really act like links to other pages, they are more like buttons. Again, not sure the best way forward here: Screenshot 2023-11-05 at 16 47 40

Yes, I completely agree with your viewpoint. It is important to enhance the visibility of these elements and make it clear to users that they are clickable functional elements. However, I believe we should create a new ticket to address this improvement as it is not directly related to the changes made in this PR.

@knyghty
Copy link
Member

knyghty commented Nov 6, 2023

For the sidebar filter, I can maybe agree, however there is a regression for the datetime inputs as this PR removes the colour. See this example from 4.2:

Screenshot 2023-11-06 at 14 40 19

@yushanfans2233
Copy link
Author

Yes, there is a regression on this link, but I don’t believe it was introduced by my PR. I am running an admin site with the latest code from the Django main branch, and it does not display as blue.

image

If you want, I can fix it in this PR.

@knyghty knyghty self-requested a review November 7, 2023 14:51
@felixxm felixxm requested a review from a team December 27, 2023 12:29
@keramblock
Copy link

Any news on this PR? We also need that =(

@nessita
Copy link
Contributor

nessita commented Jan 8, 2024

Any news on this PR? We also need that =(

As per the latest activity, it seems that this PR needs a review from the @django/accessibility team.

Copy link
Member

@knyghty knyghty left a comment

Choose a reason for hiding this comment

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

We had a good chat about this at our latest @django/accessibility meeting.

We agreed that for now, we should just fix the colours and not add the underline.

We should still do the underline part, but as a new ticket, because:

  • The changes can easily be done separately.
  • Because of the difficulty in deciding what should and shouldn’t be underlined, it’s better to get the less contentious change out first.

@nessita
Copy link
Contributor

nessita commented Jan 17, 2024

We had a good chat about this at our latest @django/accessibility meeting.

We agreed that for now, we should just fix the colours and not add the underline.

We should still do the underline part, but as a new ticket, because:

* The changes can easily be done separately.

* Because of the difficulty in deciding what should and shouldn't be underlined, it's better to get the less contentious change out first.

Thank you @knyghty. I agree that separating the link color change from the underlining work is a good path forward. Therefore I recommend:

  • File a new ticket for the color link regression, so I can triage it as a release blocker and we can provide the minimal fix suitable for backporting, and
  • Potentially re-title the original ticket #34038 to focus on the underlines.

What do you think?

@knyghty
Copy link
Member

knyghty commented Jan 17, 2024

@nessita sounds good on my end

@yushanfans2233
Copy link
Author

Dear Django community,

I regret to inform you that due to my current busy schedule, I am unable to continue working on this PR for the time being. However, please know that I remain eager to assist if needed on any other project within the community.
So I suggest to close this PR and transfer the ticket to others.

Thank you for your understanding.

@nessita
Copy link
Contributor

nessita commented Jan 20, 2024

Dear Django community,

I regret to inform you that due to my current busy schedule, I am unable to continue working on this PR for the time being. However, please know that I remain eager to assist if needed on any other project within the community. So I suggest to close this PR and transfer the ticket to others.

Thank you for your understanding.

No worries @yushanfans2233, we appreciate everything you have done so far! Thank you for letting us know.

@nessita nessita closed this Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants