Skip to content

Sidebar implementation in Next Js and Changing styles #3561

Answered by SiTaggart
ehsaan-changa asked this question in Q&A
Discussion options

You must be logged in to vote

Hi

It's potentailly a little buried, but as outlined in the Elements API docs, you are able to nest any CSS selector under an element name. That includes attribute selectors for targeting ARIA attributes that are used for accessibility.

THe selected item has the aria-current="page" attribute added, so you could add an attribute selector like

"SIDEBAR_NAVIGATION_ITEM": {
  "&[aria-current='page']": {
    ...styles
  },
  "&[aria-current='page']:hover": {
    ...styles
  },
  "&[aria-current='page']:focus": {
    ...styles
  }
}

etc

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@ehsaan-changa
Comment options

@SiTaggart
Comment options

Answer selected by serifluous
@ehsaan-changa
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
External This Discussion was posted by a non-Twilio Paste consumer
3 participants