# Disabled ValidationTextbox widgets are editable in IE 11 when Caret browsing is enabled

**URL:** https://discourse.dojo.io/t/disabled-validationtextbox-widgets-are-editable-in-ie-11-when-caret-browsing-is-enabled/96
**Category:** Dojo 1.x users
**Created:** [December 14, 2017, 9:40pm UTC](https://discourse.dojo.io/t/disabled-validationtextbox-widgets-are-editable-in-ie-11-when-caret-browsing-is-enabled/96 "2017-12-14T21:40:32Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![schallm](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@schallm](https://discourse.dojo.io/u/schallm)
#### Post date: [December 14, 2017, 9:40pm UTC](https://discourse.dojo.io/t/disabled-validationtextbox-widgets-are-editable-in-ie-11-when-caret-browsing-is-enabled/96/1 "2017-12-14T21:40:32Z")

</div>

Calling the following in IE with Caret browsing enabled will make the textbox look disabled, but the textbox can still be changed.

```javascript
widget.set("disabled", true);

```

This is actually an issue with any input html tag in IE when Caret browsing is enabled (Hit F7 to enable or View-\>Caret browsing). The following html displays the issue:

```auto
<!DOCTYPE html>
<html>
<body>
    <h1>disabled</h1>
    <input type="text" value="hello world" disabled />
    <h1>disabled/readonly</h1>
    <input type="text" value="hello world" disabled readonly />
</body>
</html>

```

Put cursor in first textbox and the value is changed when typing without any events firing (keydown/keyup/…).

Potential workaround is to also mark disabled textboxes as readonly. Notice the second does not have the same issue.

Below is a patch to fix trident browsers that will:

- mark an input as readonly if setting disabled
- mark an input as not readonly if this code marked it while setting disabled

```diff
Index: _FormWidgetMixin.js
===================================================================
--- _FormWidgetMixin.js	(revision 6004)
+++ _FormWidgetMixin.js	(revision 6007)
@@ -75,6 +75,23 @@
 			// Can't use "disabled" in this.focusNode as a test because on IE, that's true for all nodes.
 			if(/^(button|input|select|textarea|optgroup|option|fieldset)$/i.test(this.focusNode.tagName)){
 				domAttr.set(this.focusNode, 'disabled', value);
+ // IE has a Caret Browsing mode (hit F7 to activate) where disabled textboxes can be modified
+ // textboxes marked readonly avoid this issue.
+ // If setting widget disabled and widget is not already readonly, also set readonly.
+ // If setting widget enabled, and this code set readonly, set to non-readonly
+ if (has("trident")) {
+ if (value) {
+ if (domAttr.get(this.focusNode, 'readonly') === false) {
+ domAttr.set(this.focusNode, 'readonly', true);
+ this._disabledSetReadonly = true;
+ }
+ } else {
+ if (this._disabledSetReadonly) {
+ domAttr.set(this.focusNode, 'readonly', false);
+ this._disabledSetReadonly = false;
+ }
+ }
+ }
 			}else{
 				this.focusNode.setAttribute("aria-disabled", value ? "true" : "false");
 			}

```

---

<div class="post-metadata">

### Author: ![dylan](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dojo.io/dylan/32/5_2.png) [@dylan](https://discourse.dojo.io/u/dylan)
#### Post date: [December 19, 2017, 4:37pm UTC](https://discourse.dojo.io/t/disabled-validationtextbox-widgets-are-editable-in-ie-11-when-caret-browsing-is-enabled/96/2 "2017-12-19T16:37:57Z")

</div>

Interesting, and looks like a reasonable fix. Would you be interested in providing this as a pull request per the [contribution guidelines](https://github.com/dojo/dijit/blob/master/CONTRIBUTING.md) and then I can get this reviewed and landed in Dijit?

Thanks,  
-Dylan

---

<div class="post-metadata">

### Author: ![schallm](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@schallm](https://discourse.dojo.io/u/schallm)
#### Post date: [January 24, 2018, 9:33pm UTC](https://discourse.dojo.io/t/disabled-validationtextbox-widgets-are-editable-in-ie-11-when-caret-browsing-is-enabled/96/3 "2018-01-24T21:33:23Z")

</div>

I created the pull request here… Let me know if you need anything else…

[https://github.com/dojo/dijit/pull/136](https://github.com/dojo/dijit/pull/136)

---

<div class="post-metadata">

### Author: ![dylan](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dojo.io/dylan/32/5_2.png) [@dylan](https://discourse.dojo.io/u/dylan)
#### Post date: [February 7, 2018, 4:53pm UTC](https://discourse.dojo.io/t/disabled-validationtextbox-widgets-are-editable-in-ie-11-when-caret-browsing-is-enabled/96/4 "2018-02-07T16:53:05Z")

</div>

Please see the feedback in the PR, and then we’ll work to get this landed.
