feat: !important inline styles are not applied in Stencil JSX
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- frontend
Research direction
Clone the linked reproduction, inspect the inline style in my-component.tsx, and run npm i && npm start. Confirm the input remains visible despite the document-level opacity: 1 !important rule; done means the JSX inline !important style is applied and the input is hidden.
Written by the indexing model from the issue text.
Description
Stencil version:
@stencil/core@2.4.0
I'm submitting a:
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/
Current behavior:
When applying inline styles with the !important rule, the style is simply ignored and not applied even though it is valid HTML and accepted by the browser.
Expected behavior:
Stencil should apply inline styles with !important so that component CSS can have ultimate control over styles for HTML that is not in shadow DOM and therefore accessible to outside styling rules.
Steps to reproduce:
Reproduction: https://github.com/eriklharper/stencil-important-inline-style-not-applied
git clone https://github.com/eriklharper/stencil-important-inline-style-not-applied
cd stencil-important-inline-style-not-applied
npm i && npm start
Observe that the input is visible when it should be hidden. The opacity: 1 !important rule set on the HTML document takes precedence over the style rule defined inline in the my-component.tsx file.
Related code:
See: https://github.com/eriklharper/stencil-important-inline-style-not-applied
Other information:
This codepen demonstrates that it is valid practice to insert inline styles including the !important rule, and they do in fact take precedence over !important styles defined in the head of the document.
Original question thread in the Stencil Slack channel: https://stencil-worldwide.slack.com/archives/C79EANFL7/p1613074893132100
- Dominant language
- TypeScript
- Stars
- 13.1k
- Forks
- 855
- Avg merge
- 4h 7m
- Merged PRs (30d)
- 44
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stenciljs/core
-
Stencil v5
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Stencil v5
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Bug: Validated Stencil v5
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Feature: Want this? Upvote it!
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Feature: Want this? Upvote it!
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·