-
Notifications
You must be signed in to change notification settings - Fork 397
Improve accessibility for checkboxes #2874
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
Changes from 16 commits
bfaa2cc
8d33a91
1da832d
ad01c49
c2a2d52
fb426c2
7500636
2cc90c4
bf813bf
04eacd7
03b20d5
5c0e6d3
714004a
c42074d
f85803a
f034831
96e0692
6fb9a63
e8e6c79
6b2ad39
597cd7a
db3f73e
8957ff6
84ab077
b5fb3d9
dd7a49f
b954a76
520429b
ad2062b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -415,8 +415,7 @@ public function getSearchResult($view) | |
| */ | ||
| public function getCheckbox($idPrefix = '', $formAttr = false, $number = null) | ||
| { | ||
| $id = $this->driver->getSourceIdentifier() . '|' | ||
| . $this->driver->getUniqueId(); | ||
| $id = $this->getUniqueIdWithSource(); | ||
| $context | ||
| = ['id' => $id, 'number' => $number, 'prefix' => $idPrefix]; | ||
| if ($formAttr) { | ||
|
|
@@ -707,4 +706,14 @@ protected function deduplicateLinks($links) | |
| { | ||
| return array_values(array_unique($links, SORT_REGULAR)); | ||
| } | ||
|
|
||
| /** | ||
| * Get the source identifier + unique id of the record | ||
| * | ||
| * @return string | ||
| */ | ||
| public function getUniqueIdWithSource() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some further suggested revisions here. Maybe we should rename this to After doing a bit of research, I see that HTML5 element IDs support nearly all characters, but not whitespace -- so to be on the safe side, I think when we use a record ID as an element ID, we should ensure that whitespace is eliminated. (Hopefully the odds of an ID collision caused by replacing whitespace with underscores are small enough that we don't need to worry... but if we ARE worried, we could also do something different like
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed that. Should we use the escapeHtmlAttr helper directly within the record view helper and remove escaping of in templates?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @RLangeUni! I don't think auto-escaping the ID will work, because in some cases we're passing the ID as an array value to the URL helper, which will also automatically escape it -- and we don't want to end up with double-escaped values. We could add a flag parameter for escaping, or have two different method names for escaped vs. unescaped versions, but that seems potentially overcomplicated. It might be tidier to refactor more of the templates to use the |
||
| { | ||
| return "{$this->driver->getSourceIdentifier()}|{$this->driver->getUniqueId()}"; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.