Skip to content

Commit

Permalink
fix(useMobileMenu): remove invalid underscores from id and use global…
Browse files Browse the repository at this point in the history
… id prefix

HTML id's should not start with underscores.
  • Loading branch information
patrickcate committed Feb 25, 2024
1 parent d2fcf80 commit 6ed0dc8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/UsaHeader/UsaHeader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ describe('UsaHeader', () => {
.should(
'have.attr',
'aria-controls',
'__vuswds-id-global-mobile-header-menu'
'vuswds-id-global-mobile-header-menu'
)

cy.get('nav.usa-nav')
.as('nav')
.should('have.id', '__vuswds-id-global-mobile-header-menu')
.should('have.id', 'vuswds-id-global-mobile-header-menu')

cy.get('@nav').should('not.have.class', 'is-visible').and('not.be.visible')
cy.get('@nav').find('> div.usa-nav__inner').should('not.exist')
Expand Down
3 changes: 2 additions & 1 deletion src/composables/useMobileMenu.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { ref, readonly } from 'vue'
import { ID_PREFIX } from '@/utils/constants.js'

export const isMobileMenuOpen = /*#__PURE__*/ ref(false)
export const menuId = /*#__PURE__*/ ref('__vuswds-id-global-mobile-header-menu')

export function useMobileMenu(emit) {
const menuId = ref(`${ID_PREFIX}global-mobile-header-menu`)
const mobileMenuOpenClass = 'usa-js-mobile-nav--active'

const closeMobileMenu = () => {
Expand Down

0 comments on commit 6ed0dc8

Please sign in to comment.