Skip to content

Commit

Permalink
Merge pull request #331 from imgiseverything/a11y/add-semantics-to-in…
Browse files Browse the repository at this point in the history
…put-button

Accessibility: Add semantics to textInput
  • Loading branch information
OvidijusParsiunas authored Jan 13, 2025
2 parents c8962ce + 0d938d7 commit e5dcd44
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions component/src/views/chat/input/textInput/textInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,15 @@ export class TextInputEl {
const inputElement = document.createElement('div');
inputElement.id = TextInputEl.TEXT_INPUT_ID;
inputElement.classList.add('text-input-styling');
inputElement.role = 'textbox';
if (Browser.IS_CHROMIUM) TextInputEl.preventAutomaticScrollUpOnNewLine(inputElement);
if (typeof this._config.disabled === 'boolean' && this._config.disabled === true) {
inputElement.contentEditable = 'false';
inputElement.classList.add('text-input-disabled');
inputElement.setAttribute('aria-disabled', 'true');
} else {
inputElement.contentEditable = 'true';
inputElement.removeAttribute('aria-disabled');
this.addEventListeners(inputElement);
}
Object.assign(inputElement.style, this._config.styles?.text);
Expand Down Expand Up @@ -127,6 +130,7 @@ export class TextInputEl {

private setPlaceholderText(text: string) {
this.inputElementRef.setAttribute('deep-chat-placeholder-text', text);
this.inputElementRef.setAttribute('aria-label', text);
}

public isTextInputEmpty() {
Expand Down

0 comments on commit e5dcd44

Please sign in to comment.