@vaadin/field-base
Advanced tools
Comparing version 23.0.0-alpha1 to 23.0.0-alpha2
{ | ||
"name": "@vaadin/field-base", | ||
"version": "23.0.0-alpha1", | ||
"version": "23.0.0-alpha2", | ||
"publishConfig": { | ||
@@ -34,3 +34,3 @@ "access": "public" | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/component-base": "23.0.0-alpha1", | ||
"@vaadin/component-base": "23.0.0-alpha2", | ||
"lit": "^2.0.0" | ||
@@ -43,3 +43,3 @@ }, | ||
}, | ||
"gitHead": "fbcb07328fdf88260e3b461088d207426b21c710" | ||
"gitHead": "070f586dead02ca41b66717820c647f48bf1665f" | ||
} |
@@ -6,2 +6,3 @@ /** | ||
*/ | ||
import { addValueToAttribute, removeValueFromAttribute } from './utils.js'; | ||
@@ -164,14 +165,10 @@ /** | ||
const value = this.__target.getAttribute(attr); | ||
const ids = value ? new Set(value.split(' ')) : new Set(); | ||
if (oldId) { | ||
ids.delete(oldId); | ||
removeValueFromAttribute(this.__target, attr, oldId); | ||
} | ||
if (newId) { | ||
ids.add(newId); | ||
addValueToAttribute(this.__target, attr, newId); | ||
} | ||
this.__target.setAttribute(attr, [...ids].join(' ')); | ||
} | ||
} |
@@ -304,2 +304,3 @@ /** | ||
error.textContent = hasError ? errorMessage : ''; | ||
error.hidden = !hasError; | ||
this.toggleAttribute('has-error-message', hasError); | ||
@@ -372,10 +373,16 @@ | ||
_invalidChanged(invalid) { | ||
// Error message ID needs to be dynamically added / removed based on the validity | ||
// Otherwise assistive technologies would announce the error, even if we hide it. | ||
if (invalid) { | ||
this._fieldAriaController.setErrorId(this._errorId); | ||
} else { | ||
this._fieldAriaController.setErrorId(null); | ||
} | ||
// This timeout is needed to prevent NVDA from announcing the error message twice: | ||
// 1. Once adding the `[role=alert]` attribute by the `_updateErrorMessage` method (OK). | ||
// 2. Once linking the error ID with the ARIA target here (unwanted). | ||
// Related issue: https://github.com/vaadin/web-components/issues/3061. | ||
setTimeout(() => { | ||
// Error message ID needs to be dynamically added / removed based on the validity | ||
// Otherwise assistive technologies would announce the error, even if we hide it. | ||
if (invalid) { | ||
this._fieldAriaController.setErrorId(this._errorId); | ||
} else { | ||
this._fieldAriaController.setErrorId(null); | ||
} | ||
}); | ||
} | ||
}; |
@@ -52,5 +52,4 @@ /** | ||
return this.inputElement.checkValidity(); | ||
} else { | ||
return !this.invalid; | ||
} | ||
return !this.invalid; | ||
} | ||
@@ -57,0 +56,0 @@ |
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
import { SlotController } from './slot-controller.js'; | ||
import { SlotController } from '@vaadin/component-base/src/slot-controller.js'; | ||
@@ -12,2 +12,2 @@ /** | ||
*/ | ||
export class InputController implements SlotController {} | ||
export class InputController extends SlotController {} |
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
import { SlotController } from './slot-controller.js'; | ||
import { SlotController } from '@vaadin/component-base/src/slot-controller.js'; | ||
@@ -14,3 +14,4 @@ /** | ||
constructor(host, callback) { | ||
super(host, [ | ||
super( | ||
host, | ||
'input', | ||
@@ -35,4 +36,4 @@ () => document.createElement('input'), | ||
} | ||
]); | ||
); | ||
} | ||
} |
@@ -58,3 +58,2 @@ /** | ||
}); | ||
return; | ||
} | ||
@@ -61,0 +60,0 @@ } |
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
import { SlotController } from './slot-controller.js'; | ||
import { SlotController } from '@vaadin/component-base/src/slot-controller.js'; | ||
@@ -12,2 +12,2 @@ /** | ||
*/ | ||
export class TextAreaController implements SlotController {} | ||
export class TextAreaController extends SlotController {} |
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
import { SlotController } from './slot-controller.js'; | ||
import { SlotController } from '@vaadin/component-base/src/slot-controller.js'; | ||
@@ -14,3 +14,4 @@ /** | ||
constructor(host, callback) { | ||
super(host, [ | ||
super( | ||
host, | ||
'textarea', | ||
@@ -38,4 +39,4 @@ () => document.createElement('textarea'), | ||
} | ||
]); | ||
); | ||
} | ||
} |
103461
2762
+ Added@vaadin/component-base@23.0.0-alpha2(transitive)
- Removed@vaadin/component-base@23.0.0-alpha1(transitive)