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.

generic-switch stylability without parts and progressive enhancement

See original GitHub issue

Styling

The generic-switch is somewhat of a headache. If a browser supports ::part, the component is fully stylable, if they dont however, it’ll just look like the default ‘ugly’ switch.

In other components this is less of a problem, because they depend on user provided lightdom, e.g. the listbox:

<generic-listbox>
  <ul>
    <li>item 1</li>
    <li>item 2</li>
  </ul>
</generic-listbox>

Progressive enhancement

Progressive enhancement is somewhat of another problem here. The only ‘sensible’ thing I can currently think of is having the user provide a native checkbox as lightdom. If theres a case where there is no JS available, it would just fallback to a checkbox. But this feels a bit weird/unnatural to do, because while somewhat similar, a checkbox is not a switch button, and the checkbox wouldnt be used by the generic-switch internally at all. It’d only be there for fallback reasons.

It takes away from the simplicity and ease of use of just using a <generic-switch> and dropping it in your page as well.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jordanaustincommented, May 10, 2020

As far as custom styling, what about just sprinkling in some css custom properties which has a little wider browser support to give the user the ability to style the switch at a basic level?

Definitely a little sad to lose the simplicity of just <generic-switch> but if you’re going for progressive enhancement it seems like the only real option is to force the user to add a checkbox input into the lifghtdom (still 😢).

0reactions
jordanaustincommented, May 11, 2020

RE progressive enhancement, that seems pretty good. To me it would awesome to conditionally add the checkbox to lightdom if you wanted a fallback 🤷

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · thepassle/generic-components - GitHub
generic-switch stylability without parts and progressive enhancement opinions wanted V1. #14 opened on May 9, 2020 by thepassle V1.
Read more >
What Is Progressive Enhancement? - MakeUseOf
Progressive enhancement is a technique that helps to ensure your software is robust and accessible. By following it, you can ensure as many ......
Read more >
GitHub is home to over 40 million developers ... - fasrcooking
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. Sign up....
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