microsoft / fluentui

Fluent UI web represents a collection of utilities, React components, and web components for building web applications.
https://react.fluentui.dev
Other
18.31k stars 2.72k forks source link

[Feature]: Spinner root slot as span #32416

Open mathis-m opened 2 weeks ago

mathis-m commented 2 weeks ago

Library

React Components / v9 (@fluentui/react-components)

Describe the feature that you would like added

It would be great to allow span root slot type for the Spinner component. This would help to keep the dom nesting valid for a scenario where a spinner needs to be inside a Paragraph element.

Currently I need to cast the as prop to make this work:

<Spinner as={"span" as unknown as "div"}/>

Have you discussed this feature with our team

No response

Additional context

My use-case is a spinner within a richtext editor.
Users can add certain custom elements to the richtext which are requiring async data load.
While loading the spinner should be displayed.
As this is a richtext editor the root element of each paragraph the user is entering is a p tag.

Validations

Priority

Low

Hotell commented 2 weeks ago

not sure if this is a bug on our side as spec mentions span for root element ? @tomi-msft https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-spinner/library/docs/Spec.md?plain=1#L73

mathis-m commented 2 weeks ago

Prop Type div:

https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-spinner/library/src/components/Spinner/Spinner.types.ts#L9

Slot Implementation https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-spinner/library/src/components/Spinner/useSpinner.tsx#L23-L39