Skip to content

Commit

Permalink
Respect spellcheck/autocorrect/autocapitalize options in textarea inp…
Browse files Browse the repository at this point in the history
…ut style

Issue codemirror#7009
  • Loading branch information
marijnh authored and mrdrogdrog committed Feb 27, 2023
1 parent d85fec2 commit 8b5bfd7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/input/ContentEditableInput.js
Expand Up @@ -94,6 +94,7 @@ export default class ContentEditableInput {
}
// Old-fashioned briefly-focus-a-textarea hack
let kludge = hiddenTextarea(), te = kludge.firstChild
disableBrowserMagic(te)
cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild)
te.value = lastCopied.text.join("\n")
let hadFocus = activeElt(div.ownerDocument)
Expand Down
4 changes: 3 additions & 1 deletion src/input/TextareaInput.js
@@ -1,6 +1,6 @@
import { operation, runInOp } from "../display/operations.js"
import { prepareSelection } from "../display/selection.js"
import { applyTextInput, copyableRanges, handlePaste, hiddenTextarea, setLastCopied } from "./input.js"
import { applyTextInput, copyableRanges, handlePaste, hiddenTextarea, disableBrowserMagic, setLastCopied } from "./input.js"
import { cursorCoords, posFromMouse } from "../measurement/position_measurement.js"
import { eventInWidget } from "../measurement/widgets.js"
import { simpleSelection } from "../model/selection.js"
Expand Down Expand Up @@ -117,6 +117,8 @@ export default class TextareaInput {
// The semihidden textarea that is focused when the editor is
// focused, and receives input.
this.textarea = this.wrapper.firstChild
let opts = this.cm.options
disableBrowserMagic(this.textarea, opts.spellcheck, opts.autocorrect, opts.autocapitalize)
}

screenReaderLabelChanged(label) {
Expand Down
1 change: 0 additions & 1 deletion src/input/input.js
Expand Up @@ -130,6 +130,5 @@ export function hiddenTextarea() {
else te.setAttribute("wrap", "off")
// If border: 0; -- iOS fails to open keyboard (issue #1287)
if (ios) te.style.border = "1px solid black"
disableBrowserMagic(te)
return div
}

0 comments on commit 8b5bfd7

Please sign in to comment.