File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 2828 </ ul >
2929 </ hx-dd >
3030 </ hx-def >
31+ < hx-def >
32+ < hx-dt > Events</ hx-dt >
33+ < hx-dd >
34+ Any of the following:
35+ < ul >
36+ < li > < code > close</ code > </ li >
37+ < li > < code > open</ code > </ li >
38+ </ ul >
39+ </ hx-dd >
40+ </ hx-def >
3141 </ hx-dl >
3242 </ section >
3343{% endblock %}
Original file line number Diff line number Diff line change @@ -29,8 +29,13 @@ export class HXMenuElement extends HXElement {
2929 document . removeEventListener ( 'click' , this . _onDocumentClick ) ;
3030 }
3131
32- attributeChangedCallback ( attr , oldValue , newValue ) {
33- this . setAttribute ( 'aria-expanded' , newValue === '' ) ;
32+ attributeChangedCallback ( attr , oldVal , newVal ) {
33+ let isOpen = ( newVal !== null ) ;
34+ this . setAttribute ( 'aria-expanded' , isOpen ) ;
35+
36+ if ( newVal !== oldVal ) {
37+ this . $emit ( isOpen ? 'open' : 'close' ) ;
38+ }
3439 }
3540
3641 set position ( value ) {
@@ -68,10 +73,8 @@ export class HXMenuElement extends HXElement {
6873 if ( value ) {
6974 this . setAttribute ( 'open' , '' ) ;
7075 this . _setPosition ( ) ;
71- this . $emit ( 'open' ) ;
7276 } else {
7377 this . removeAttribute ( 'open' ) ;
74- this . $emit ( 'close' ) ;
7578 }
7679 }
7780
You can’t perform that action at this time.
0 commit comments