question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extraneous kebab-case warning for media queries

See original GitHub issue

Relevant code:


mq.sm = `@media (min-width: 800px)`

<div css={{
	[mq.sm]: {
		display: 'flex'
	}
}}>

What happened:

Error: Using kebab-case for css properties in objects is not supported. Did you mean @media (minWidth: 800px)?

Problem description: Emotion warns about kebab case on media queries but probably should not. Using a kebab-casing of the original media query ie (minWidth: 800px) does not work as intended.

Suggested solution: Relax the warning for media queries

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Andaristcommented, Apr 22, 2020

@corysimmons this is a different issue than reported originally here. And the warning you have received is sound - when using object styles you should use camel-cased properties. The same would have been reported for styled elements:

styled.div({
  'font-size': 16
})
1reaction
clight-fastlycommented, Jan 29, 2019

Ah, through the process in trying to create one I found that my media query value was undefined which caused the error. ie

<div css={{
	['@media (min-width 800px)']: undefined
}}/>

If the value is an object, there is no warning. The warning could perhaps be improved but I wouldn’t consider it a bug. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using media queries - CSS: Cascading Style Sheets | MDN
Media queries are case-insensitive. Media types define the broad category of device for which the media query applies: all , print , screen...
Read more >
vue 3 emit warning " Extraneous non-emits event listeners"
I am trying to emit data from child to parent using the composition API. I get the following warning.
Read more >
CSS masterclass – Media Queries
Media Queries select different style sheets for: different media: print, screen, projection, speech… different media characteristics: width, height, resolution…
Read more >
Working with JavaScript Media Queries
matchMedia('(min-width: 768px)') // Check if the media query is true if (mediaQuery.matches) { // Then trigger an alert alert('Media Query ...
Read more >
CSS and Javascript media queries
matches) { alert('Large Media Query Matched!') } Finally, we can listen for the changes function handleResizeChange(e) { // Check if the media ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found