mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-22 13:20:50 +01:00
WIP accessibility: focus, aria-label and -description for date/time fields
This commit is contained in:
parent
6e84a75714
commit
e1d4c61e9d
@ -482,6 +482,26 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(LitFlatpickr))
|
|||||||
// initializeComponent() so this._inputNode is not available before this
|
// initializeComponent() so this._inputNode is not available before this
|
||||||
this.findInputField().addEventListener('change', this._updateValueOnChange);
|
this.findInputField().addEventListener('change', this._updateValueOnChange);
|
||||||
this.findInputField().addEventListener("input", this._handleInputChange);
|
this.findInputField().addEventListener("input", this._handleInputChange);
|
||||||
|
|
||||||
|
// pass aria(Label|Description) to real input node
|
||||||
|
const input = this.getInputNode();
|
||||||
|
if (input)
|
||||||
|
{
|
||||||
|
input.ariaLabel = this.ariaLabel || this.placeholder;
|
||||||
|
input.ariaDescription = this.ariaDescription || this.statustext ||
|
||||||
|
this.egw().lang('Format')+' '+this.getOptions().altFormat.split('').map(c => {
|
||||||
|
switch(c)
|
||||||
|
{
|
||||||
|
case 'Y': return this.egw().lang('Year');
|
||||||
|
case 'm': return this.egw().lang('Month');
|
||||||
|
case 'd': return this.egw().lang('Day');
|
||||||
|
case 'h':
|
||||||
|
case 'H': return this.egw().lang('Hour');
|
||||||
|
case 'i': return this.egw().lang('Minute');
|
||||||
|
default: return c;
|
||||||
|
}
|
||||||
|
}).join(' ');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -925,6 +945,24 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(LitFlatpickr))
|
|||||||
return <HTMLInputElement>this._inputNode?.shadowRoot?.querySelector('input:not([type="hidden"])');
|
return <HTMLInputElement>this._inputNode?.shadowRoot?.querySelector('input:not([type="hidden"])');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getInputNode()
|
||||||
|
{
|
||||||
|
if(typeof egwIsMobile == "function" && egwIsMobile())
|
||||||
|
{
|
||||||
|
return super.getInputNode();
|
||||||
|
}
|
||||||
|
return this.findInputField();
|
||||||
|
}
|
||||||
|
|
||||||
|
focus()
|
||||||
|
{
|
||||||
|
if(!(typeof egwIsMobile == "function" && egwIsMobile()))
|
||||||
|
{
|
||||||
|
this.open();
|
||||||
|
}
|
||||||
|
this.getInputNode()?.focus();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The interactive (form) element.
|
* The interactive (form) element.
|
||||||
* This is an et2-textbox, which causes some problems with flatpickr
|
* This is an et2-textbox, which causes some problems with flatpickr
|
||||||
|
Loading…
Reference in New Issue
Block a user