()
| 287 | } |
| 288 | |
| 289 | async connectedCallback() { |
| 290 | const { el } = this; |
| 291 | |
| 292 | this.notchController = createNotchController( |
| 293 | el, |
| 294 | () => this.notchSpacerEl, |
| 295 | () => this.labelSlot |
| 296 | ); |
| 297 | |
| 298 | this.updateOverlayOptions(); |
| 299 | this.emitStyle(); |
| 300 | |
| 301 | this.mutationO = watchForOptions<HTMLIonSelectOptionElement>(this.el, 'ion-select-option', async () => { |
| 302 | this.updateOverlayOptions(); |
| 303 | |
| 304 | /** |
| 305 | * We need to re-render the component |
| 306 | * because one of the new ion-select-option |
| 307 | * elements may match the value. In this case, |
| 308 | * the rendered selected text should be updated. |
| 309 | */ |
| 310 | forceUpdate(this); |
| 311 | }); |
| 312 | |
| 313 | // Watch for class changes to update validation state. |
| 314 | if (Build.isBrowser && typeof MutationObserver !== 'undefined') { |
| 315 | this.validationObserver = new MutationObserver(() => { |
| 316 | const newIsInvalid = checkInvalidState(this.el); |
| 317 | if (this.isInvalid !== newIsInvalid) { |
| 318 | this.isInvalid = newIsInvalid; |
| 319 | /** |
| 320 | * Screen readers tend to announce changes |
| 321 | * to `aria-describedby` when the attribute |
| 322 | * is changed during a blur event for a |
| 323 | * native form control. |
| 324 | * However, the announcement can be spotty |
| 325 | * when using a non-native form control |
| 326 | * and `forceUpdate()`. |
| 327 | * This is due to `forceUpdate()` internally |
| 328 | * rescheduling the DOM update to a lower |
| 329 | * priority queue regardless if it's called |
| 330 | * inside a Promise or not, thus causing |
| 331 | * the screen reader to potentially miss the |
| 332 | * change. |
| 333 | * By using a State variable inside a Promise, |
| 334 | * it guarantees a re-render immediately at |
| 335 | * a higher priority. |
| 336 | */ |
| 337 | Promise.resolve().then(() => { |
| 338 | this.hintTextId = this.getHintTextId(); |
| 339 | }); |
| 340 | } |
| 341 | }); |
| 342 | |
| 343 | this.validationObserver.observe(el, { |
| 344 | attributes: true, |
| 345 | attributeFilter: ['class'], |
| 346 | }); |
nothing calls this directly
no test coverage detected