Skip to content

Commit

Permalink
fix(action-menu): spectrum adherence update
Browse files Browse the repository at this point in the history
  • Loading branch information
Westbrook authored and adixon-adobe committed Jan 22, 2020
1 parent 08c727d commit 6eb1860
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/action-menu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The visible label that is be provided via the default `<slot>` interface can be
<!-- prettier-ignore -->
```html
<sp-action-menu label="More Actions">
<sp-menu slot="options">
<sp-menu slot="options" style="min-width: 125px">
<sp-menu-item>
Deselect
</sp-menu-item>
Expand Down
7 changes: 7 additions & 0 deletions packages/action-menu/src/action-menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@ governing permissions and limitations under the License.
}

.icon {
/* Sizing for .icon is needed because we are using a raw <svg> due to https://github.com/adobe/spectrum-web-components/issues/155 */
width: 18px;
height: 18px;

/**
* Because .icon is acting as default content for its slot, the `::slotted([slot="icon"])` styles do not apply.
* In the future it may be necessary to add a default content selector to the style processing code.
*/
flex-shrink: 0;
}

#popover {
Expand Down
5 changes: 3 additions & 2 deletions packages/action-menu/src/action-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import {
PropertyValues,
html,
} from 'lit-element';
import { Dropdown } from '@spectrum-web-components/dropdown';
import { DropdownBase } from '@spectrum-web-components/dropdown';
import { ObserveSlotText } from '@spectrum-web-components/shared/lib/observe-slot-text';
import actionMenuStyles from './action-menu.css.js';

/**
* @slot options - The menu with options that will display when the dropdown is open
*/
export class ActionMenu extends ObserveSlotText(Dropdown) {
export class ActionMenu extends ObserveSlotText(DropdownBase) {
public static get styles(): CSSResultArray {
return [...super.styles, actionMenuStyles];
}
Expand All @@ -51,6 +51,7 @@ export class ActionMenu extends ObserveSlotText(Dropdown) {
class="icon"
focusable="false"
aria-hidden="true"
fill="currentColor"
>
<circle cx="17.8" cy="18.2" r="3.4"></circle>
<circle cx="29.5" cy="18.2" r="3.4"></circle>
Expand Down
9 changes: 7 additions & 2 deletions packages/dropdown/src/dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ import '@spectrum-web-components/popover';
* @slot default - The placeholder content for the dropdown
* @slot options - The menu with options that will display when the dropdown is open
*/
export class Dropdown extends Focusable {
export class DropdownBase extends Focusable {
public static get styles(): CSSResultArray {
return [
...super.styles,
actionButtonStyles,
fieldButtonStyles,
dropdownStyles,
alertSmallStyles,
chevronDownMediumStyles,
Expand Down Expand Up @@ -296,3 +295,9 @@ export class Dropdown extends Focusable {
}
}
}

export class Dropdown extends DropdownBase {
public static get styles(): CSSResultArray {
return [...super.styles, fieldButtonStyles];
}
}

0 comments on commit 6eb1860

Please sign in to comment.