Selected ListItem styles not working with SSR
See original GitHub issueWith client-side rendering the first item gets the mdc-list-item--selected
class and aria-selected="true"
as expected. However with server-side rendering (tested with next.js) this is not the case (and all the items look the same). I believe it’s an issue with this library rather than material-components-web?
<List
singleSelection
selectedIndex={0}
>
<ListItem>
<ListItemText primaryText='One' />
</ListItem>
<ListItem>
<ListItemText primaryText='Two' />
</ListItem>
<ListItem>
<ListItemText primaryText='Three' />
</ListItem>
</List>
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Styled-components - CSS class not applied with SSR
I have an issue when I navigate to a page using links, my CSS classes are not all applied. ... Whereas when I...
Read more >react-select-search
Start using react-select-search in your project by running `npm i react-select-search`. There are 17 other projects in the npm registry ...
Read more >React List component - Material UI
Lists are continuous, vertical indexes of text or images.
Read more >Implementing SSR in Next.js: Dynamic routing and ...
Implementing server-side rendering on specific pages could be a challenging task, however. Next.js attempts to solve this problem by allowing ...
Read more >Server-Side Rendering (SSR)
Browser-specific code can only be used inside certain lifecycle hooks; ... The HTML is completely static on the client since we are not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dan-kwiat thanks for figuring that out! I spent quite a bit of time and couldn’t figure it out. I’ll try testing this out with your SSR demo.
Merged #509…thanks again!