themesberg / themesberg/flowbite

Style error in Angular reusable input text components

Open
#964 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
9.4k
Forks
862
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
When trying to make a reusable input component in Angular and wanting to pass a type property with @Input, the preset styles for the <input> tags are applied because of the CSS selectors

To Reproduce
Steps to reproduce the behavior:

  1. Create an Angular component to make a reusable input text.
  2. Add @Input() type: string = 'text'; inside the component.
  3. Import and use the input component inside the page component.
  4. Add the type attribute with a valid value like email, like this type="email".
  5. Run the development server and view in the browser

Screenshots
image
image
image

Expected behavior
If CSS selectors were more specific, for example input[type=email] instead of [type=email], then the styles would only apply to tags and not to components with a custom attribute called type created by the developer.

This is how it should look without those unwanted styles:
image
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Angular reusable input component described in the reproduction and locate the component styles using selectors such as [type=email]. Compare the rendered behavior for a native input and a custom component with a type input. Done means type-specific styles apply only to input elements, without affecting custom components.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, css, tailwindcss
Domain
design, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.