Skip to content

Provide a method for InlineSpan to override the styles of its children #177952

Description

@Renzo-Olivares

Issue

I'd like to be able to override the styles of all children of an InlineSpan tree. Currently each InlineSpan has a local representation of its TextStyle and InlineSpan children, so you cannot simply wrap an InlineSpan with another InlineSpan and expect the parents InlineSpan.style to override it's child's. This is by design, since nested spans can define their own TextStyles.

Proposal

InlineSpan should have some mechanism to override the TextStyles of its InlineSpan children. Currently textScaler is able to penetrate an entire InlineSpan tree because the InlineSpan.build method has a textScaler member. We can take a similar approach and add individual styling members to the build method as needed or we can add a style argument that is passed down to all children.

Use case

For accessibility use cases like updating text spacing settings to match certain standards like WCAG, it is required to be able to change the spacing settings of all text. Currently with InlineSpans this can only be done at the root of the span tree, and if children spans locally define their own styles there is no method to change their styles outside of recreating the span itself. Recreating the span itself is not a robust solution since you can only do this for InlineSpans subclasses you own.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsa: typographyText rendering, possibly libtxtteam-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions