@@ -25,19 +25,21 @@ export class ComponentNameElement extends HTMLElement {
2525 }
2626
2727 connectedCallback ( ) {
28- // Upgrade properties that may have been set before the element was defined
29- this . _upgradeProperty ( 'exampleAttribute' ) ;
28+ Promise . resolve ( ) . then ( ( ) => {
29+ // Upgrade properties that may have been set before the element was defined
30+ this . _upgradeProperty ( 'exampleAttribute' ) ;
3031
31- // Check for global attributes before setting defaults
32- // Don't override author-set attributes
33- if ( ! this . hasAttribute ( 'role' ) ) {
34- // this.setAttribute('role', 'group'); // Example - set appropriate role
35- }
36- if ( ! this . hasAttribute ( 'tabindex' ) ) {
37- // this.setAttribute('tabindex', 0); // Example - set if focusable
38- }
32+ // Check for global attributes before setting defaults
33+ // Don't override author-set attributes
34+ if ( ! this . hasAttribute ( 'role' ) ) {
35+ // this.setAttribute('role', 'group'); // Example - set appropriate role
36+ }
37+ if ( ! this . hasAttribute ( 'tabindex' ) ) {
38+ // this.setAttribute('tabindex', 0); // Example - set if focusable
39+ }
3940
40- this . render ( ) ;
41+ this . render ( ) ;
42+ } ) ;
4143 }
4244
4345 attributeChangedCallback ( name , oldValue , newValue ) {
@@ -104,7 +106,7 @@ export class ComponentNameElement extends HTMLElement {
104106 :host {
105107 display: block;
106108 }
107-
109+
108110 /* Support the hidden attribute properly */
109111 :host([hidden]) {
110112 display: none;
0 commit comments