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.

Forgotten variable in CSS

See original GitHub issue

Expected behavior

Don’t have undefined CSS variables.

Actual behavior

There are undefined CSS Variables

Steps to reproduce

If you look there, you’ll see this declaration:

::-webkit-slider-runnable-track{
  background:0 0;
  border:0;
  border-radius:3px;
  height:6px;
  transition:all .3s ease;
  -webkit-user-select:none;
  user-select:none;
  background-image:linear-gradient(to right,currentColor var(--value),transparent var(--value))
}

Which has the --value variable there. Comes from here https://github.com/sampotts/plyr/blob/600f0eb8a3cf49f5268e5c15487797d496bc19b6/src/sass/components/sliders.scss#L22

It does seem the only element having a var notation. Keen to submit a PR but unsure what the intended value was.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
Antonio-Lagunacommented, Mar 20, 2018

Thanks a lot for the inside. When I inspected the shadow dom and saw the value progressing then it struck me. Really clever!

0reactions
sampottscommented, Mar 20, 2018

Sorry for the abrupt answer. Basically all browsers have capacity to allow you to style the “lower fill” of an <input type="range"> slider. Edge even allows you to style both sides! WebKit however is missing this, for whatever reason. In v2 I dealt with this by displaying a <progress> behind the slider but always felt it was a hack and then discovered it was possible to use JS + CSS variables (since WebKit supported them ages ago) to set the values of a background gradient instead. This is the JavaScript part of it:

https://github.com/sampotts/plyr/blob/master/src/js/controls.js#L15

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to reset a CSS variable (aka custom properties) and use ...
I am trying to have CSS variables for box model properties. I want to support both setting a value for all sides as...
Read more >
var() - CSS: Cascading Style Sheets - MDN Web Docs - Mozilla
The var() CSS function can be used to insert the value of a custom property (sometimes called a "CSS variable") instead of any...
Read more >
Everything you need to know about CSS Variables
Once a variable has been defined and assigned a value, you can go ahead and use it within a property value. There's a...
Read more >
What no one told you about CSS Variables
To use easy words: a CSS variable will make the status of a property in a standby mode until we do the evaluation....
Read more >
How to use variables in CSS - SitePoint
CSS Variables (officially known as custom properties) are user defined values that can be set once and used many times throughout your ...
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