User tests: Successful: Unsuccessful:
Pull Request for Issue # .
adds aria-current="page"
to active menu item.
select a menu item to make it active.
view source for active menu item.
should look like "actual result" image.
apply patch
aria-current="page"
should be before the >
in the anchor for the "active" menu item.
as shown in the "expected result" image.
Now select or create as needed a alias menu item
repeat above steps.
None
Status | New | ⇒ | Pending |
Category | ⇒ | Modules Front End |
Labels |
Added:
?
|
aria-current="page"
ok, as soon as I figure out why GIT is telling me to flack off I'll try to fix it.. ty.
Title |
|
@brianteeman would it be applied to the list item or the anchor?
Exactly as it is written in the page I linked to
Can't seem to figure out what creates the menu item when the menu type is "single article"
SOLVED
@brianteeman ready for testing
Why are you excluding setting aria-current when its the home?
sorry - I misread the diff - i think - will test later
turns out that when the menu item is an alias ( like top bar home in protostar ) although it gets the "active & current" classes it's ID doesn't match the active id value because that is to its referenced menu item. SO, there's another id that references its parent so you have to test against that one too ergo the last commit
It is because you changed the formatting. You can see changes without whitespace changes here https://github.com/joomla/joomla-cms/pull/26261/files?w=1.
It is because you changed the formatting. You can see changes without whitespace changes here https://github.com/joomla/joomla-cms/pull/26261/files?w=1.
whew!! ty @SharkyKZ my chest is literally pounding cause I thought I somehow totally messed things up and was freaking out trying to figure out how the hell I did that!
This is what freaked me out.
How did you find the link for w/o formatting?
When viewing changed files, click the gear icon and select Hide whitespace changes
.
Category | Modules Front End | ⇒ | Libraries Modules Front End |
Category | Modules Front End Libraries | ⇒ | Modules Front End |
I have tested this item
Adding aria-current is perfectly ok
Removing or changing classes is not. This will potentially break any site that is using those classes for styling
Removing or changing classes is not.
@brianteeman What are you talking about?
I have not tested this item.
Reset my test - the way github displayed the diff it made it look like classes were changed
I have tested this item
I have tested this item
I have tested this item
It works
Status | Pending | ⇒ | Ready to Commit |
RTC
There are some things wrong in this PR.
in default_component.php you try to check if the active_id is in aliasoptions, thats not possible because aliasoptions is only used if the type is "alias". So you can remove this.
You use the same if in default_url.php which will is also wrong. In this case $item->id can't be $active_id reason for this is that in this case the type is "url" and url can't be active. Also the second part of this if statement is wrong because you try to access $item->params as array but it's a JRegistry for this you have to access it with the ->get method.
The other thing is the attribute it self, Joomla's menu system is really weak for the current page. it uses anything that has the correct Itemid as current. Which basically doesn't need to be true for example for blog posts in categories. For example if you read a article in a "news" category the menu item is highlighted but it doesn't link to the current article instead it links to the "news" category.
The j4 implementation is more correct using the complete url to set this attribute.
The other thing is the attribute it self, Joomla's menu system is really weak for the current page. it uses anything that has the correct Itemid as current. Which basically doesn't need to be true for example for blog posts in categories. For example if you read a article in a "news" category the menu item is highlighted but it doesn't link to the current article instead it links to the "news" category.
You are confusing things here. The purpose of this PR is to inform users of assistive technology with information that tells them exactly which menu item is the active one - ie the menu item that was clicked last. Your example seems to be talking about a canonical link which is not the same thing at all.
Your PR for J4 #26326 adds aria-current="page" only if the complete url is the same.
No thats not correct. It does what I believe the code here does and adds it to the active menu item
Why should it be different in j4 then in j3? ymmv
I dont believe (I've not checked the code here) it is just that the implementation is different
At the end of the day the objective of this aria attribute is to provide an accessible alternative to adding css to a menu link to indicate it is the currently selected menu link
NOTE my J4 pr is for the admin - this is for the frontend - where the sub-items that dont have menu links (which is what I guess your example would be) have the main menu hidden. So we're probably both getting a little confused here as we're comparing apples to lemons I'm not even sure if I am convinced that this should be in core
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Pending |
Removed RTC.
Removed RTC.
I give up. It's always a fight to do anything.
Someone else can take the heat.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-12-06 12:29:43 |
Closed_By | ⇒ | N6REJ | |
Labels |
Removed:
?
|
The right idea but completely the wrong implementation ;)
You just need to use an aria attribute called aria-current on the active link - in this case it would be aria-current="page"
See https://tink.uk/using-the-aria-current-attribute/
note this needs to be done in j4 admin menu as well if you want to submit a pr for that