Skip to content

Commit 06c87e7

Browse files
authored
change(floating-panel): default strategy to fixed (#33)
1 parent b59ec92 commit 06c87e7

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1212
- Support arrow in Floating panel element
1313
- Allow trigger id to be set in the Floating panel element
1414

15+
### Changed
16+
17+
- Set Floating Panel element's default strategy to "fixed"
18+
1519
## [0.2.0] - 2024-01-14
1620

1721
### Added

packages/core/src/elements/floating_panel/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ For more info, visit the [official docs](https://floating-ui.com/docs/computePos
4949

5050
### Setting the positioning strategy
5151

52-
By default, the positioning strategy is set as `absolute`, but you can set it to one of `absolute` or `fixed` by
52+
By default, the positioning strategy is set as `fixed`, but you can set it to one of `absolute` or `fixed` by
5353
setting the `strategy` attribute on the element.
5454

5555
```html
56-
<twc-floating-panel strategy="fixed">
56+
<twc-floating-panel strategy="absolute">
5757
...
5858
</twc-floating-panel>
5959
```

packages/core/src/elements/floating_panel/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('Floating panel', () => {
2222
await waitUntil(() => el.hasAttribute('data-current-placement'));
2323
expect(el).to.have.attribute('data-current-placement', 'bottom-start');
2424
expect(panel).to.have.attribute('data-current-placement', 'bottom-start');
25-
expect(panel).to.have.style('position', 'absolute');
25+
expect(panel).to.have.style('position', 'fixed');
2626

2727
el.active = false;
2828
expect(el).not.to.have.attribute('active');

packages/core/src/elements/floating_panel/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default class FloatingPanelElement extends ImpulseElement {
3939
* One of 'absolute' or 'fixed'.
4040
* https://floating-ui.com/docs/computeposition#strategy
4141
*/
42-
@property() strategy: Strategy = 'absolute';
42+
@property() strategy: Strategy = 'fixed';
4343

4444
/**
4545
* The initial position of the panel. This placement can be changed to keep the panel within the viewport.

0 commit comments

Comments
 (0)