Skip to content

Commit 7232dde

Browse files
authored
Dropdown fix (#1122)
* _blank * fix dropdown flip/shift/ behavior when the viewport doesn't have space
1 parent f63001f commit 7232dde

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

packages/webawesome/docs/.eleventy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,17 +188,17 @@ export default async function (eleventyConfig) {
188188
// Replace [issue:1234] with a link to the issue on GitHub
189189
{
190190
replace: /\[pr:([0-9]+)\]/gs,
191-
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/pull/$1">#$1</a>',
191+
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/pull/$1" target="_blank">#$1</a>',
192192
},
193193
// Replace [pr:1234] with a link to the pull request on GitHub
194194
{
195195
replace: /\[issue:([0-9]+)\]/gs,
196-
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/issues/$1">#$1</a>',
196+
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/issues/$1" target="_blank">#$1</a>',
197197
},
198198
// Replace [discuss:1234] with a link to the discussion on GitHub
199199
{
200200
replace: /\[discuss:([0-9]+)\]/gs,
201-
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/discussions/$1">#$1</a>',
201+
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/discussions/$1" target="_blank">#$1</a>',
202202
},
203203
]),
204204
);

packages/webawesome/docs/docs/resources/changelog.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@ Web Awesome follows [Semantic Versioning](https://semver.org/). Breaking changes
88

99
Components with the <wa-badge variant="warning">Experimental</wa-badge> badge should not be used in production. They are made available as release candidates for development and testing purposes. As such, changes to experimental components will not be subject to semantic versioning.
1010

11-
## next
11+
## Next
1212

1313
### New Features {data-no-outline}
1414

1515
- Added `.wa-hover-rows` to native styles to opt-in to highlighting table rows on hover.
1616

17+
### Bug Fixes and Improvements {data-no-outline}
18+
19+
- Fixed a bug in `<wa-dropdown>` that prevented the menu from flipping/shifting to keep the menu in the viewport [discuss:1106]
20+
1721
## 3.0.0-beta.1
1822

1923
We're excited to share the first beta release of Web Awesome, which includes some breaking changes that make the library significantly more intuitive and consistent!
@@ -34,8 +38,10 @@ Many of these changes and improvements were the direct result of feedback from u
3438
- Renamed the `classic` theme to `shoelace`
3539
- Removed `:root` selector from all theme, color palette, and semantic color stylesheets except for the default theme and colors. All of these styles are now solely scoped to classes, such as `.wa-theme-awesome`, `.wa-palette-bright`, and `.wa-brand-orange`.
3640
- Removed most custom properties from components that can otherwise be styled with `::part()` selectors and standard CSS properties.
41+
<<<<<<< HEAD
3742
- `<wa-dropdown>` was reworked and simplified to not use menu, menu item, menu label; use `<wa-dropdown-item>` instead
38-
- Renamed `pulse` attribute in `<wa-badge>` to `attention="pulse"` and added `attention="bounce"` [issue:#940]
43+
- Renamed `pulse` attribute in `<wa-badge>` to `attention="pulse"` and added `attention="bounce"` [issue:940]
44+
> > > > > > > next
3945
- Renamed the `vertical` attribute to `orientation="vertical"` in `<wa-split-panel>` and `<wa-divider>` to align with other components and the platform [issue:674]
4046
- Renamed certain boolean attributes to be consistent using the `with-*` and `without-*` pattern:
4147
- `<wa-button caret>` => `<wa-button with-caret>`

packages/webawesome/src/components/dropdown/dropdown.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
#menu {
88
display: flex;
9-
position: absolute;
10-
top: 0;
11-
left: 0;
129
flex-direction: column;
1310
width: max-content;
1411
margin: 0;

packages/webawesome/src/components/dropdown/dropdown.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,16 @@ export default class WaDropdown extends WebAwesomeElement {
698698
let active = this.hasUpdated ? this.popup.active : this.open;
699699

700700
return html`
701-
<wa-popup placement=${this.placement} distance=${this.distance} skidding=${this.skidding} ?active=${active}>
701+
<wa-popup
702+
placement=${this.placement}
703+
distance=${this.distance}
704+
skidding=${this.skidding}
705+
?active=${active}
706+
flip
707+
flip-fallback-strategy="best-fit"
708+
shift
709+
shift-padding="8"
710+
>
702711
<slot
703712
name="trigger"
704713
slot="anchor"

0 commit comments

Comments
 (0)