Skip to content

Allow developers to create attribute filters for elements wrapped in <Localized> #139

Closed
@stasm

Description

@stasm

Part of #103.

Right now <Localized> will apply all attributes found in the translation to the element wrapped inside of it. This may potentially override important props.

We should allow developers to control which attributes will be applied. For the initial release of overlays in fluent-react I think it's OK to err on the side of explicitness and only allow attributes which are explicitly declared by the developer.

button = This button has a title attribute.
    .title = Title
    .other = This attribute will not be applied to the translation.
<Localized id="button" attrs="title">
    <button>{'This button has a title attribute.'}</button>
</Localized>

What should be the type of the attrs prop?

  • A string, ssimilar to className: attrs="title placeholder".
  • An array: attrs={["title", "placeholder"]}.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions