ccswbs / hjckrrh

GNU General Public License v2.0
6 stars 5 forks source link

G4 - Current page not highlighted in some cases #203

Closed jpinsent closed 8 years ago

jpinsent commented 9 years ago

Looking at AODA Demo, if you click on some of the links in the local nav, sometimes they are not indicated as being the current page.

For example, if you click on 'Page', 'FAQ' or 'Services' in the local nav, it receives the class "active-trail active". This highlights it and makes screen readers read "(current page)" afterwards. If you click on 'Events' or 'Our People' in the local nav, they do not receive the class and are not indicated as being the current page.

Upon further investigation, only pages with full URLs under Structure>Menus>Main Menu seem to be causing this bug. 'News' was not receiving the "active-trail active" class until after I shortened its url from full (https://aoda.web.uoguelph.ca/aodademo/news) to partial (news).

mmafe commented 8 years ago

This can be solved by not using the full path when entering the link into the menu.

For events, I changed the url from https://aoda.web.uoguelph.ca/aodademo/events to just "events" This caused it to receive the active-trail active classes. Same with Our People, this became "people" and worked afterwards.

We can help clients avoid the issue through training (cc @mancusop) and perhaps creating a unit test that checks that whether the menu item that is currently active has the "active" or "active-trail" class on it. I'll add a card to the backlog of possible unit tests.

@jpinsent Could you review this briefly and if the solution sounds good, please close the issue.

jpinsent commented 8 years ago

Just tested this and it appears to be working as specified above. This issue will be resolved through client training.

mancusop commented 8 years ago

@jpinsent @mmafe Is this an issue that occurs via screen readers? Trying to recreate issue.

For training, does this mean when content editors want to create menu links within the local site to only use shorthand paths like "events" instead of https://aoda.web.uoguelph.ca/aodademo/events ?

jpinsent commented 8 years ago

@mancusop It is not exclusively a screen reader issue, but screen readers are affected.

You're exactly right with your comment on the training. To recreate the issue, go to Structure > Menus and create one menu link with the path 'events' and another with 'https://aoda.web.uoguelph.ca/aodademo/events'. You will notice that if you click on the menu item with the absolute path, the menu link is not highlighted, whereas the one with the relative path is. events menu items

Menu items with an absolute path do not receive the "active-trail active" class, and as such are not highlighted. On top of this, the screen reader will not read "current page" when the menu item is hovered over.

mancusop commented 8 years ago

@jpinsent Ok thanks I see it now.

Discussion: This may not actually be a "bug" and may just be how drupal interprets absolute paths as commonly being external links and not setting an active-trail active class and thinking the user has left the site. i.e. assuming absolute paths as being external(even if they aren't) and relative paths as internal and thus needing the "current page" attribute?

jpinsent commented 8 years ago

@mancusop That sounds about right. This was originally logged as a bug because the cause of the issue was not known; some menu links on the AODA Demo were relative whereas others absolute, causing some menu links to behave as intended and others to not. Now that the cause of this issue is known, it is more likely a deliberate Drupal quirk than a bug.

Nevertheless, clients should be made aware of this when linking to content in their menus.