-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Fix a accessibility issue to allow screenreader to read a label when … #6197
Changes from 1 commit
44647c3
08b629c
42fad1f
3128aa0
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 |
---|---|---|
|
@@ -132,6 +132,7 @@ export function defineOptions(CodeMirror) { | |
} | ||
cm.display.input.readOnlyChanged(val) | ||
}) | ||
option("srLabel", 'CodeMirror text input') | ||
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. I think I'd prefer to call this option either just |
||
option("disableInput", false, (cm, val) => {if (!val) cm.display.input.reset()}, true) | ||
option("dragDrop", true, dragDropChanged) | ||
option("allowDropFileTypes", null) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,9 +119,15 @@ export function disableBrowserMagic(field, spellcheck, autocorrect, autocapitali | |
field.setAttribute("spellcheck", !!spellcheck) | ||
} | ||
|
||
export function hiddenTextarea() { | ||
export function hiddenTextarea(label) { | ||
let te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none") | ||
let div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;") | ||
let te_id = 'cm-textarea-' + Math.floor(Math.random() * 9999) | ||
te.setAttribute('id', te_id) | ||
/* Label for screenreaders, accessibility */ | ||
let le = elt("label", label, null, 'position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;') | ||
le.setAttribute('for', te_id) | ||
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. Why aren't you using an |
||
|
||
let div = elt("div", [te, le], null, "overflow: hidden; position: relative; width: 3px; height: 0px;") | ||
// The textarea is kept positioned near the cursor to prevent the | ||
// fact that it'll be scrolled into view on input from scrolling | ||
// our fake cursor out of view. On webkit, when wrap=off, paste is | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's "focused" (one s)