Skip to content

Commit e3d10fb

Browse files
committed
fix: enhance accessibility by adding aria-labelledby to the textarea for improved screen reader support
Signed-off-by: Parth Raiyani <[email protected]> Change-Id: I0207c7c914034160fa9a01f4135beac2be637cbf
1 parent c4980db commit e3d10fb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

browser/src/layer/marker/TextInput.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,11 @@ window.L.TextInput = window.L.Layer.extend({
405405
_initLayout: function() {
406406
this._container = window.L.DomUtil.create('div', 'clipboard-container');
407407
this._container.id = 'doc-clipboard-container';
408+
409+
this._textAreaLabel = window.L.DomUtil.create('label', 'visuallyhidden', this._container);
410+
this._textAreaLabel.id = 'clipboard-area-label';
411+
this._textAreaLabel.innerHTML = 'clipboard area';
412+
408413
// The textarea allows the keyboard to pop up and so on.
409414
// Note that the contents of the textarea are NOT deleted on each composed
410415
// word, in order to make
@@ -416,10 +421,8 @@ window.L.TextInput = window.L.Layer.extend({
416421
this._textArea.setAttribute('autocorrect', 'off');
417422
this._textArea.setAttribute('autocomplete', 'off');
418423
this._textArea.setAttribute('spellcheck', 'false');
424+
this._textArea.setAttribute('aria-labelledby', this._textAreaLabel.id);
419425

420-
this._textAreaLabel = window.L.DomUtil.create('label', 'visuallyhidden', this._container);
421-
this._textAreaLabel.setAttribute('for', 'clipboard-area');
422-
this._textAreaLabel.innerHTML = 'clipboard area';
423426
if (this.hasAccessibilitySupport()) {
424427
this._setSelectionFlag(false);
425428
}

0 commit comments

Comments
 (0)