core-components icon indicating copy to clipboard operation
core-components copied to clipboard

core-toggle is positioned outside viewport on mobile

Open johannesodland opened this issue 2 years ago • 0 comments

When using autopositon on core-toggle the component checks if there is enough room for the element if it starts at the left side of the button. If not, it defaults to hanging from the right side of the button. https://github.com/nrkno/core-components/blob/4e035069e2329143bc694a3c828099b4550de2a9/packages/core-toggle/core-toggle.js#L75

On mobile, this will often cause the element to be positioned with a negative value in the left property.

This could be solved by limiting the left and right values to 0 and window.innerWidth.

As an addition it would be nice if the component supported a positioning scheme where the element is positioned directly below the button, and not hanging to the left or right.

johannesodland avatar Jun 30 '22 08:06 johannesodland