floating-ui / floating-ui/popper.js.org

Arrows gets twice position:absolute

Open
#44 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
MDX
Stars
85
Forks
406
PR merge metrics
No merged PRs in 30d

Description

https://popper.js.org/docs/v2/tutorial/#arrow suggests this call:
```html


My tooltip


```
and
```css
#arrow,
#arrow::before {
position: absolute;
width: 8px;
height: 8px;
background: inherit;
}
```
As far as I can see, the `arrow` modified assigns the element with `id="arrow"` to `state.elements.arrow`. The `appyStyles` modifier sets `state.elements.arrow.style.position='absolute'`.

This means, that by following the tutorial the `position` style for the arrow-element is set twice to absolute: once using CSS and once by Javascript.

Please adjust either the tutorial, not to recommend setting explictly `#arrow, #arrow::before { position: absolute }`, or the arrow/applyStyle modifiers not to set for the arrow-element `position: absolute`.

E.g. the example shall set `position: absolute` for `#arrow::before`, but not for `#arrow` itself.

Moved from https://github.com/floating-ui/floating-ui/issues/1528.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.