Skip to content

bug: label inheriting color if any parent element has color prop #20125

Closed
@JamieWritesCode

Description

@JamieWritesCode

#19711 Bug Report

Ionic version: 4.11.7

Current behavior:

<p> tags inside ion-labels receive an override class to set their color: inherit based on the existence of a parent element with the .ion-color class. I assume this is to support setting the color property of the ion-label or ion-item and having the p tag adjust accordingly, which is fine - however the CSS selector used to target this behaviour is a bit loose and causes the color: inherit property to be applied if ANY parent element has a color attribute set.

This doesn't seem like the intended behaviour. For example, if I set color="light" on my ion-content element in order to adjust the background colour of my content, any nested ion-labels will have their p tags adjusted - even if I intended to have the "default" styling on the list, item, and label elements.

Expected behavior:

I would think that the intended behaviour would be to limit the scope of the CSS selector to just parent ion-labels or ion-items?

Steps to reproduce:

See related code. I've created two tabs - one showing current behaviour and the other with it's component scss adjusted to illustrate expected behaviour.

Related code:

https://stackblitz.com/edit/ionic-v4-angular-tabs-gqkmdr

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions