ginader / HTML5-placeholder-polyfill

Small and robust polyfill for the HTML5 placeholder attribut.
GNU General Public License v2.0
223 stars 85 forks source link

remove node instead of hiding when a11y is turned off #10

Open ginader opened 12 years ago

ginader commented 12 years ago

good comment by Alexander Farkas mentions that Internet Explorer will send the whole content of a label to the Accessibility API no matter if it's display:none or not. To work around that issue let's remove the placeholder node (plus force refresh the virtual buffer) in the label on focus to avoid it being read when visibleToScreenreaders is set to false

aFarkas commented 12 years ago

I'm not sure wether this will work correctly. As you may already noticed from your prior tests with screenreaders changing the name or a property of an element right in the case, the user is interacting with the element, can lead to the result, that the old and the new "value" is read to the screenreader. The best way (most secure, no need to test with screenreader) to workaround this, is to place the placeholder-text outside of the label.

And you really don't need to force a refresh, the user is already interacting with a form element and not a "normal" node (=virtual buffer is likley up-to-date).

ginader commented 12 years ago

Yeah I guess there's no reason to put it into the label in the first place when visibleToScreenreaders is set to false so I will only do that when it's set to true and place it outside otherwise. Thanks Alexander :-)