fix(ui): LionInputStepper focus issue

This commit is contained in:
Oleksii Okadurin 2024-03-04 09:41:28 +01:00 committed by Thijs Louisse
parent f1630c0881
commit ea71f6194b

View file

@ -196,7 +196,10 @@ export class LionInputStepper extends LocalizeMixin(LionInput) {
const incrementButton = this.__getSlot('suffix'); const incrementButton = this.__getSlot('suffix');
const disableIncrementor = this.currentValue >= max && max !== Infinity; const disableIncrementor = this.currentValue >= max && max !== Infinity;
const disableDecrementor = this.currentValue <= min && min !== Infinity; const disableDecrementor = this.currentValue <= min && min !== Infinity;
if (disableDecrementor || disableIncrementor) { if (
(disableDecrementor && decrementButton === document.activeElement) ||
(disableIncrementor && incrementButton === document.activeElement)
) {
this._inputNode.focus(); this._inputNode.focus();
} }
decrementButton[disableDecrementor ? 'setAttribute' : 'removeAttribute']('disabled', 'true'); decrementButton[disableDecrementor ? 'setAttribute' : 'removeAttribute']('disabled', 'true');