miljodir / md-components

Design-komponenter for Miljødirektoratet (CSS og React)
https://miljodir.github.io/md-components
MIT License
3 stars 2 forks source link

Fix for MdRadioGroup absolute positioning #63

Closed kajsaeggum closed 10 months ago

kajsaeggum commented 10 months ago

Describe your changes

The individual radio inputs of MdRadioGroup are absolutely positioned, without having a parent element within the component as relatively positioned. This resulted in weird positioning behaviour in a real life application since the position then became relative to an element further up the DOM, outside of the MdRadioGroup component itself.

Also used option.id when concatenating the options id-prop, instead of option.text which is more likely to be something more than plain text or number. (In my case the option.text-prop was a ReactNode/JSX element, which resulted in an id that looked like radio_customGroupName_[object: Object]

Checklist before requesting a review