When accessing local task links (normally themed as tabs) with a screen-reader it is not possible to determine the context, or role, of the links or which link is active. This is because there is no semantic markup to provide this information.
theme_menu_local_tasks http://api.drupal.org/api/function/theme_menu_local_tasks/7
theme_menu_local_task http://api.drupal.org/api/function/theme_menu_local_task/7
Recommendation
Provide semantic markup for ul and active li item to indicate the role of the links and which task (tab) is active.
Comment | File | Size | Author |
---|---|---|---|
#91 | drupal.active-task.91.patch | 2.46 KB | bowersox |
#86 | drupal.active-task.86.patch | 1.43 KB | mgifford |
#84 | drupal.active-task.84.patch | 1.43 KB | mgifford |
#79 | drupal.active-task.79.patch | 1.29 KB | bowersox |
#68 | drupal.active-task.68.patch | 2.07 KB | mgifford |
Comments
Comment #1
Everett Zufelt CreditAttribution: Everett Zufelt commentedaccessibility
Comment #2
Everett Zufelt CreditAttribution: Everett Zufelt commentedThis issue can be broken down into two parts:
1. Provide markup in theme_menu_local_tasks to provide indication that the ul of links is actually functionally a tabstrip.
2. Provide markup to indicate which link is the current active task.
Part 1 is quite simple, part two I have researched and the following is what is required.
1. Modify menu_local_tasks to pass information about the current active task to theme_menu_item_link (called as theme('menu_item_link', ...)).
2. Modify theme_menu_item_link to test if this is the current active task and then use a similar technique as described in #526712: l() does not accept a parameter for supplemental text for screen-readers comment 25 to provide contextual information for screen-reader users.
Comment #3
Dave Cohen CreditAttribution: Dave Cohen commentedWe also need to know the depth of the menu item. (see #371453: theme_menu_local_task does not differentiate between primary and secondary local tasks) Or is that what you mean by "context"?
Comment #4
bowersox CreditAttribution: bowersox commentedsubscribing
Comment #5
Nick Lewis CreditAttribution: Nick Lewis commentedCould someone offer a sample of what a "semantic" active secondary task might look like??
Comment #6
Everett Zufelt CreditAttribution: Everett Zufelt commented@Dave
If possible I would like to provide the functionality to distinguish menu typs. But, I do feel like this is best dealt with in the separate issue that you have opened.
@Nick
I believe that what Dave is talking about here is thematic context (a different class for primary and secondary tasks) whereas I am talking about providing textual information to provide a context for which task is active.
Comment #7
Everett Zufelt CreditAttribution: Everett Zufelt commentedRolled a patch for this issue:
This is not complete as:
1. menu_local_tasks() only sets 'active' = TRUE in options array for theme('menu_item_link', ...) if the default task is active.
2. theme_menu_item_link() is appending " (active task)" to the link text if 'active' is TRUE, but is not wrapping the appended text in a
<span class="element-invisible"></span>
for testing purposes.Any assistance tracking down the other sections where menu_local_tasks needs to set active = TRUE would be appreciated.
Comment #8
Dave Cohen CreditAttribution: Dave Cohen commentedIt would be so easy to add $level to that array. Why not do it?
I think the same array of information should be passed to theme('menu_local_task', ...) But I see that's a bigger change because that function would take new parameters.
Comment #9
Everett Zufelt CreditAttribution: Everett Zufelt commentedThis patch creates a new local variable in menu_local_task $active_task and assigns it true or false depending on if the current $item[] is an active task.
$active_task is then passed as 'active' in the options array for theme('menu_item_link',....).
theme_menu_item_link() tests for 'active' and appends ' (Active task)' to the local task link. Once this has been tested I will make sure that the appended link text is wrapped in
<span classs="element-invisible"> </span>
Comment #11
Everett Zufelt CreditAttribution: Everett Zufelt commentedThe patch above failed Node Edit -> Edit tab found. The test will need to be modified in order for this patch to pass, but first we need to agree upon the language to append to the local task link.
Comment #12
sunI believe what you really want is this.
Comment #13
Everett Zufelt CreditAttribution: Everett Zufelt commented@Sun
Thanks for coming out with this patch.
Unfortunately setting the title attribute to "active" does not correct the accessibility problem, as it is not recognized by most screen-readers, and for some screen-readers is read instead of the link text.
Also, I do not believe that the context of "active" is required for all links, only links that are part of a tabstrip. That is, if the main menu of the site has several options, it is not necessary to know which is selected, but it is important, in many situations, to know which local task is selected. An example of where it is important to know which local task is selected is on http://api.drupal.org, where when looking at a particular function there are local tasks for different versions of drupal, but currently no way to know which task / version is selected.
Comment #14
sunHrm. I see the difference now - you added the " (active)" string to the link text, not to the title attribute like in my patch.
However, that would look a bit strange for users that are used to get a visual highlighting of the currently active link(s).
Isn't there some other, reliable way to pass on textual information/attributes to screen-readers?
Comment #15
Everett Zufelt CreditAttribution: Everett Zufelt commented@Sun
Thanks again.
I intend to hide the "active" text with a span and class="element-invisible" once testing on the other parts of the patch are complete. I left the text visible for easier testing, making sure that "active" is actually appearing where it is needed.
There really isn't a reliable way to provide information for screen-reader users, that is different than the information presented visibly, than to use element-invisible, and in this case that would be within the link text.
I think that my modifications to menu_local_tasks() are working as desired in my second patch, and will discuss best wording for the appended text on the D7 accessibility call tomorrow.
Comment #16
mgiffordThis is a great solution. It looks good and it will provide such an accessibility improvement for the whole interface!
Thanks for rolling the patch!
Mike
Comment #17
Everett Zufelt CreditAttribution: Everett Zufelt commentedrerolled the patch. This will still come up with one fail for Test Class "Node Edit" test "Edit tab found". I could use some help modifying the test in modules/node/node.test line 208 so that this can pass testing bot.
1. menu_local_tasks() now identifies active local tasks and passes the array option 'active' => true to theme('menu_item_link',...)
2. theme_menu_item_link() tests for $link['active'] and if true appends
<span class="element-invisible"> (active tab)</span>
to the $link['title'] before passing it to l().3. Sets 'html' => true for l()'s options if active = true.
Comment #19
mgiffordThe latest patch applies nicely & produces the expected results!
+1
Comment #20
Jeff Burnz CreditAttribution: Jeff Burnz commentedI question the approach this issue is taking to solve this issue (which is really one of context):
$head_title and Page $title should provide context to screen readers, last time I looked we don't use AJAX to refresh local tasks so to my mind the context is either already there, and if not, that is the place to address it.
1. The user just clicked a task or menu link - so they know where they are going.
2. The page title and heading level 1 are read out, that gives the context for the page you are on.
Currently this is not the case, since when secondary local tasks are clicked the target page when loaded does not change the title. To my mind that is the issue, I think adding invisible text to a link is a work-around - and non-standard one at that. Will screen reader users really tab through all those links (and wait to hear "active" read out) or jump headings?
Context should be provided by the semantic markup that user expects, in this case at the very least by
<title> and <h1>
.My 2 cents.
Comment #21
bowersox CreditAttribution: bowersox commentedPlease review the updated patch. The functionality of the prior patch worked as advertised and I've added a few things:
Based on my testing, the active tab hidden text works in the following places:
Further review and feedback would be great.
@jmburnz, I see your point but I wonder if we could rally the community to change the page title or h1 in all these cases. One tricky case is the node View tab. I'm not sure we could add the word View into the h1 or title tag. That would need to appear on every page for users logged in with edit permissions. If we can't put the word View into the h1 or title, this patch seems like a way to queue users that View is the current operation. I'm curious what you and others think.
Comment #22
Everett Zufelt CreditAttribution: Everett Zufelt commented@jmburnz
Thanks for te feedback. Local tasks are functionally a tabstrip of one or many tabs, one of which is active. Themed correctly * all * sighted users have the ability to know which tab is selected. * no * blind user has the ability of knowing which tab is selected. From a purely subjective perspective, I'd rather have a tab identified as "active" than extra information in pagetitle or head_title. But, this is only a preference from the perspective of one screen-reader user. Perhaps we need to address page and node titles as well, but this will need to be done in a different patch.
@brandon
Patch looks good. I do think that we need to use a placeholder in the t() string to provide context for translators, but I'm happy to be shown to be incorrect about this.
Comment #24
mgiffordI'm all for wrapping 'active tab' in a t(). It is an interface level that should be translated.
I don't think we should be piping the brackets through it though. @brandon you are using:
t('(active tab)')
But I think this is more standard:
'(' . t('active tab') . ')'
Mike
Comment #25
mohammed76hello.
I do agree about the necessity of having a way to recognize the active task, so thanks for opening this issue.
if it isn't much work, I would rather have the active task change be reflected in the title of the page, as this is more user friendly and is more expected. this would also benifit screen readers's users and sighted people alike from a usability point of view.
however, since I can't provide a patch, i would rather have usable solution roled out before the code freeze in 6 days time. the current patch sounds to be better than nothing and is surely usable.
thanks,
Mohammed al-shara.
Comment #26
mgiffordGlad to have you back involved Mohamed76. Would be especially great to have testing in RTL if you have time.
It is reflected in the title already. And it's nice that D7 even tosses in the content type that is being edited:
Edit Article Example | test sandbox install
This allows individuals to focus over the element and determine what that specific link is the active task. It's not an either or but both.
Mike
Comment #27
Jeff Burnz CreditAttribution: Jeff Burnz commentedHey, thanks for pointing that our Mike, is it possible to have this on one the test sites spoken about yesterday, I know there a few who cant have a D7 setup and would like to see the patches as applied.
Comment #28
Jeff Burnz CreditAttribution: Jeff Burnz commentedHey, thanks for pointing that our Mike, is it possible to have this on one the test sites spoken about yesterday, I know there a few who cant have a D7 setup and would like to see the patches as applied.
Comment #29
mgiffordOk, I've rerolled this patch with the i18n changes, applied it to one of our test servers --> http://drupal7.dev.openconcept.ca/
Create a new account here - http://drupal7.dev.openconcept.ca/user/register
And then send me a message to let me know so I can approve your account. I'll then give you admin access to add/remove content.
Not sure there's any better way to do this.
Mike
Comment #31
bowersox CreditAttribution: bowersox commentedI've re-rolled the patch in 29 with only one change: a fix to the Node edit test in modules/node/node.test. There was a mistake in the assertRaw() line that is fixed now:
$this->assertRaw($edit_link, t('Edit tab is active.'));
. The test passes on my environment so we'll see about the bot.Comment #32
Everett Zufelt CreditAttribution: Everett Zufelt commentedComment #34
bowersox CreditAttribution: bowersox commentedTesting the patch gives an error on node #34 but passes on my environment. Can anyone advise how best to troubleshoot the test?
I'm assuming this test is the failing test:
Comment #35
Brigadier CreditAttribution: Brigadier commentedYeah, looks like that's the test that fails and I think I see why.
The order of the class and href attributes are reversed. If the order is reliable then changing it in the patch for node.test will fix it. Looking at the available Assertions for SimpleTest I don't see any that work on the dom instead of just text though. I guess just switch the text around?
Comment #36
bowersox CreditAttribution: bowersox commented@Brigadier
Thanks for the help. A reliable option may be to go back to matching on text like the original test did. Rather than assertRaw() we could do
assertText('Edit (active tab)')
.Comment #37
bowersox CreditAttribution: bowersox commentedPlease review this updated patch. The only change is the assertText() test as discussed. Thanks, everyone!
Comment #38
Everett Zufelt CreditAttribution: Everett Zufelt commentedThis looks good to me. Once again wondering why we are not using a translation placeholder to provide context for translators for 'active tab'?
Comment #39
mgifford+1
Applied this here with no problems - http://drupal7.dev.openconcept.ca
This is a critical issue to get in core before sept 1st as per - http://openconcept.ca/blog/everett/final_stretch_help_needed_for_drupal_...
This is also will likely influence the following issue http://drupal.org/node/467296
We want the phrase 'active tab' to be translated so that when a blind screen reader is viewing the site in Thai that they get the description all in Thai:
แก้ไข (แท็บที่ใช้งาน)
Rather than in Thai & English:
แก้ไข (active tab)
This is based on a machine translation http://translate.google.ca of what appears for an English screen reader:
Edit (active tab)
Comment #40
Everett Zufelt CreditAttribution: Everett Zufelt commentedThis patch looks good, applies well and works as it should.
This effectively identifies the active tabe for screen-reader users.
Comment #41
mohammed76Hello mike,
thank you for giving me access to a test site. I can see how this issue is implimented on the site. the active tap has text telling us so: "view [active tab]". however switching to any other tab just changes the text of the active tab, like when clicking contact it says "contact [active tab]" however the title of the page still says "mohammed| open concept]" and the heading of the title also is still labled "mohammed". I was hoping ti become like "contact mohammed | open concept. or something like "mohammed | contact"
anyway, it may be too late to do so now. what should be done so the current fix goes to core? it's certainly very helpful and usable.
thanks,
Mohammed.
Comment #42
Everett Zufelt CreditAttribution: Everett Zufelt commentedCross posted, resetting to RTBC
Comment #43
sunThis is not going to work out. By setting 'html' = TRUE, you potentially expose unsafe HTML from the original menu title.
The original $link_text must be check_plain()'ed then.
'active' actually is the purpose of the second argument (TRUE) to theme_menu_local_task().
This might need some re-consideration.
Since the proper escaping is mentioned in this review, we should also verify this in a test.
4 days to code freeze. Better review yourself.
Comment #44
mgiffordThanks for this sun. We do need a little bit more information however.
The first point is excellent and we can easily roll a patch to resolve that.
We're not exactly sure how you want us to address your 2nd & 3rd points however.
We've discussed passing along strings for translation like this:
to give context rather than splitting up the task & the active tab text. I think it's going to be easier for everyone if we keep it like it is.
Are you asking us to write a simpletest to verify this? What escaping is mentioned where?
Comment #45
Everett Zufelt CreditAttribution: Everett Zufelt commented@Sun
Thanks for the feedback. Along with Mike's questions above, are you suggesting hat $active_task be passed to theme('menu_item_link', ...) as a parameter? Or, is your question more general, why we need to pass the active task state to both theme('menu_item_link') and theme('menu_local_task')?
Comment #46
bowersox CreditAttribution: bowersox commentedAs a developer and a translator, I would imagine it is simpler to leave 'active tab' translated separately from the actual tab names. If my site has 15 different tab names, I would be frustrated to find out that I needed to do 30 translations -- one for each tab name in both active and inactive state. I would rather just translate my 15 tabs like usual and then also add one translation for 'active tab' that would apply everywhere.
I support this important patch either way. Thanks for your work on this.
Comment #47
Everett Zufelt CreditAttribution: Everett Zufelt commented@brandon
I may be wrong about this. But, with using a translation placeholder you are not translatineach tab when it is active and when it is not active. You are translating all of the tab names, and translating "active tab" once. The "%menu-tab-text" is just a placeholder to give translators more context about the purpose and role of the text "active tab" so that they can do a better translation. Perhaps in some languages it is more appropriate to put active tab before the tab-text, so they can then make that change when translating.
Comment #48
annmcmeekin CreditAttribution: annmcmeekin commentedGlad to see that this issue is being worked on. Getting this information across to people who can't perceive it visually will be a real boost.
Comment #49
bowersox CreditAttribution: bowersox commented@Everett
That makes sense. Here's what I suggest:
This allows translators to translate
'!title !active'
to customize the order. And they can just translate'active tab'
once, while translating all the titles as usual.Comment #50
sun1) Please note that check_plain() must only happen when
$link['localized_options']['html']
is not already TRUE. If it is already TRUE, then the link is supposed to output HTML instead of plain-text, so you can just append your SPAN.2) I now realize that theme_menu_local_task() applies an 'active' class only to the surrounding LI and you want to alter the link's attributes. So this should be fine... Although I'm not entirely sure whether this is the right place to do it. The 'localized_options' for the menu link should already contain a class 'active-trail' for all menu links that are in the trail to the current page. If that is not the case for local tasks, then that would be a separate bug.
At the very least, you should be using the regular
$link['in_active_trail']
property (instead of the custom 'active') like elsewhere in menu.inc.3) A test should ensure what I mentioned in 1) -- menu links containing already HTML get the additional HTML appended without being check_plain()'ed, and menu links not being HTML already need to be properly escaped.
4) Should (hopefully) be covered by 2) already.
Comment #51
sunOn those last follow-ups:
#49 looks good. Yes, the SPAN should not be part of the translatable string. However, the parenthesis should, and there should be no space between the placeholders, and you need to use unique placeholder names, so translators have some clue about the string at all:
Comment #52
bowersox CreditAttribution: bowersox commentedthanks, @sun! that all makes sense.
Comment #53
Everett Zufelt CreditAttribution: Everett Zufelt commentedThis is the patch from comment #37 with suggestions in #51 implemented.
Comment #54
mgiffordI applied this and it is working well. Think this is now RTBC!
Comment #55
bowersox CreditAttribution: bowersox commentedThis patch looks great. I tested to confirm it has no visual change in Garland/Minnelli or Seven. It correctly adds the "(active tab)" invisible text to both primary and secondary tabs. I've included one Garland screenshot where the visual appearance is unchanged while the invisible text is added to both the "Configure" primary tab and "Global settings" secondary tab.
Regarding @sun's suggestion about using
$link['in_active_trail']
, unfortunately thein_active_trail
parameter is not available to theme_menu_item_link(). In the future if that becomes available we can upgrade to use it.Comment #56
Owen Barton CreditAttribution: Owen Barton commentedAdded an inline comment to indicate the purpose of the "(active)":
Otherwise unchanged, so leaving RTBC.
Comment #57
bowersox CreditAttribution: bowersox commentedYes, this new patch still applies cleanly and I tested to re-confirm that it works just like the last one. I support leaving it RTBC. Thanks, @Owen!
Comment #58
Dries CreditAttribution: Dries commentedThat t() function looks a bit unnecessary?
While I can see how this can help screen readers, I'm actually surprised that this is the way to do it. I'd expect that screen readers would automatically know that this would be active based on the URL rather than some extra markup. Shouldn't we provide markup at the ul-level to communicate that this are tabs, and then let the screen reader inidicate what is the active tab?
Comment #59
Everett Zufelt CreditAttribution: Everett Zufelt commented@Dries
Regarding the t() function, I believe that the reasoning behind this is that for some languages it is preferable to have the name of the tab displayed before the indication of "active tab" while in others it may be preferable to have "active tab" displayed before the name of the tab.
Regarding the best practices here, unfortunately no screen-reader I have used provides the user an indication if a link references the current page.
I do think that it is important to indicate that the ul is a tabstrip. perhaps the best method would be:
<h2>Node-title tabs</h2> or <h2>Tabs for Note-title</h2>
likely hidden from view with class="element-invisible. Not being to familiar with the templating of nodes, would this be possible to do in theme_menu_local_tasks() or would it need to be done in the tpl file for each theme?Comment #60
Pasquallewhy can't we just simply use something like
but the accessibility problem of the active link can be easily fixed inside l() same as the active class is added..
you may add the required functionality to this issue: #566774: Accessibility: link title attribute
Comment #61
Everett Zufelt CreditAttribution: Everett Zufelt commented@Pasqualle
Two different accessibility specialists involved with Drupal believe that the approach you have suggested is not appropriate, generalizing the functionality at worst will regress the accessibility of Drupal and at best requires far more research and brainstorming than the small hand full of accessibility specialists have time to contribute toward. Furthermore, in #526712: l() does not accept a parameter for supplemental text for screen-readers an approach to generalize the embeding of invisible text within links was discussed, and it was decided that generalizing, at least in te way discussed in that issue, was not appropriate.
The approach in this issue has been set to RTBC after quite a bit of discussion, both through the issue queue and on accessibility conference calls.
Comment #63
sunTagging.
Please re-roll.
Comment #64
mgiffordThe last patch submitted relies on functions that no longer exist - http://drupal.org/files/issues/issue-521852-active-task-8.patch
@sun
Since this function no longer exists in D7, can you point me to the patch that describes how we're supposed to do this now?
http://api.drupal.org/api/search/6/menu_item_link
Found it rather frustrating scraping around to determine how to best pass along this information.
Comment #65
bowersox CreditAttribution: bowersox commentedIt appears that #283723: Make menu_tree_output() return renderable output eliminated theme_menu_item(). Anyone who already has their head around the new code know how the best approach to pass along $active?
Comment #66
sunThis should hopefully get you "somewhere".
Comment #67
mattyoung CreditAttribution: mattyoung commentedsub
Comment #68
mgiffordThanks sun, that helped out a great deal.
I had to modify it a bit, but seems to be working fine now.
Comment #69
Everett Zufelt CreditAttribution: Everett Zufelt commentedApplied and tested this patch this morning. It appears to always add the active tab text to the first tab in the list, and not to any other tab, regardless of active status.
Does someone have an explanation of what changed so that I can attempt to reroll this patch?
Comment #70
mgifford@Everett which patch were you testing?
Setting this to needs review as I think #68 is working fine.
Comment #71
Everett Zufelt CreditAttribution: Everett Zufelt commentedYes, the patch in #68 does work correctly. Thanks for rerolling with the required changes.
We do still need to figure out the best method of adding notification that the user is about to enter a tabstrip.
1. What is the best text
2. What function, or template, should we use to add the text.
Suggestions:
a. Tabstrip
b. Tabs for node-title
c. Node-title tabs
Comment #72
bowersox CreditAttribution: bowersox commented@Everett
Usually the tabs come right after the node title, which is an h1. So what about
<span class="element-invisible">Tabs</span>
? It could be an h2 or a span. That might be better than repeating the node title twice in close proximity, especially on long pages? Do you agree?Comment #73
Everett Zufelt CreditAttribution: Everett Zufelt commented@Brandon
I wonder if theme_menu_local_tasks is the best place to place this. It is the function which themes the ul for the tabs. I question making the text a heading, as you say, the local tasks are normally displayed directly after the node title, which is a heading.
I also question if we need to provide text indicating the tabstrip at all. I imagine it would help new users. The word "Tabs" on its own does seem a little unclear to me.
What are your thoughts about "Tabs for this page" or something similar? If we were to make this a heading I think we can agree that it should be h2.
Comment #75
mgiffordtesting of bot was bust
Comment #76
Frank Ralf CreditAttribution: Frank Ralf commentedPatch at #122 of #467296: Accessibility improvements for vertical tabs should address the problem.
Comment #77
bowersox CreditAttribution: bowersox commented@Frank
Can you explain more about how that patch addresses this? This specific issue is to make the active tab (aka local task) have some invisible text in it for screenreaders saying "Active task" or a similar phrase.
-Brandon
Comment #78
Frank Ralf CreditAttribution: Frank Ralf commented@Brandon
The active vertical tab will be rendered as follows:
See Accessibility and Drupal > Drupal 7 accessibility notes.
Please note:
The vertical tabs are not "local tasks" as usual tabs but are derived from collapsible fieldsets by using jQuery .
hth
Frank
Comment #79
bowersox CreditAttribution: bowersox commentedPlease review. This has the same functionality as the prior patch by @mgifford. FYI, this was RTBC before the Paris/September code freeze.
Tests passed:
@Frank, Yes this patch essentially provides the same functionality in the way of an "(active tab)" indicator to screenreader users for the traditional tabs (View, Edit, etc) which often appear after the node title.
Comment #80
mgiffordLooks good to me Brandon. I tested it here http://drupal7.dev.openconcept.ca
Setting it back to RTBC.
Comment #81
mgiffordThis was first RTBC now over two months ago. - Bump!
Comment #82
webchick@mgifford and others: Pursuant to the Drupal 7 development schedule, patches around API clean-ups and feature exceptions were given priority during the period from Drupalcon to Oct. 15 (later extended to Oct. 17). Over the next month (from now until Dec. 1) is where we focus on accessibility, usability, and performance. Hence why some of these have been sitting in the queue for awhile.
Just a couple of things:
Can you document why you're doing this, since at first glance this appeared to be a bug, since l() is also check_plain()ing these links? (though, granted, not for those with HTML set to TRUE.)
I think there be a space between these two strings, either in this t() function call, or above where we make it an 'active tab'. Right now, if you disable CSS, the words get all smashed together like:
"Content(active tab)"
This review is powered by Dreditor.
Comment #83
bowersox CreditAttribution: bowersox commentedHere's a proposed comment that hopefully makes sense:
Also, I propose we use
t('!local-task-title !active',...)
with a space in the translatable string. That seems to be cleanest but I am happy to re-roll this patch either way if the group prefers otherwise.Comment #84
mgifford@webchick - I'm not always as patient as I should be. I'd misunderstood when accessibility issues were going to be addressed (but do think that others working on this had too).
I tracked back the check_plain()ing links to @sun's contribution here:
http://drupal.org/node/521852#comment-1980856
As he said a bit earlier "By setting 'html' = TRUE, you potentially expose unsafe HTML from the original menu title."
So I'm fine with putting in a space. I wondered about that myself as I'd seen the same issue months ago. However, screen-readers don't need the space to interpret it correctly. Still good for those that turn off their CSS every now and again.
Brandon, thanks for the offer to re-roll. I'm still recovering from the flu so had to apply the patch, and bring myself up to speed on this issue again before I could comment on it. So I've got a patch with the changes.
Comment #85
sun1) HTML, when referring to HTML, always uppercase.
2) 'html', when referring to the 'html' property, uses the capitalization of the property, and, single quotes around it.
3) TRUE is always uppercase.
4) Replace "check_plain'd" with "sanitized".
This review is powered by Dreditor.
Comment #86
mgiffordThanks sun. Standards are important and sorry I wasn't aware enough of these ones.
> + // If the link does not contain HTML already, check_plain() it now.
> + // After we set 'html'=TRUE the link will not be sanitized by l().
I've updated the patch.
Comment #88
mgiffordI'm not sure why this is failing now unless the node.test has changed.
Anyways, not sure how to resolve this error:
I tried asserting this line in (as this is what is inside the anchor tag:
and then I get xpath errors:
Not sure where to go from here.
Comment #89
sunThat happens, because assertLink() uses xpath to search for all anchor tags in the document and tests each one against the passed string.
So:
1) Basically, you should be able to test for "Edit (active tab)", because it tests for the contained text of an anchor tag.
2) However, you cannot use t('Edit (active tab)'), because t() does not return the expected value here. You need to pass the actual value to t() with the proper arguments (as in the original code).
Technically totally correct would thus be:
Comment #90
mgiffordOk, this sounds great. Detailed and useful explanation. Thanks!
But it didn't work. I tried the totally correct answer you provided and also just 'Edit (active tab)' and it didn't like either of them.
Still got the same error in SimpleTest. Don't know what I could have done wrong.
Comment #91
bowersox CreditAttribution: bowersox commentedPlease review this updated patch. The only change is to modules/node/node.test:
@sun: this is nearly identical to your suggestion, but uses assertText() instead of assertLink(). I believe assertLink() does not handle checking for link text that contains HTML mixed in. I believe it's safe to check for text instead of a link because the text "Edit (active tab)" would not appear on the page for any other reason. I couldn't find assertLink(strip_tags(...)) used anywhere else but if you have a suggestion, let us know.
Comment #92
mgiffordI applied the changes locally and it's working fine. With these changes and a happy bot I'm setting it back to RTBC.
Comment #93
webchickLooks good! Committed to HEAD.
Comment #94
mgiffordExcellent! Thanks everyone.
Comment #96
Liam Morland