Skip to content

Commit

Permalink
fix(menu): ensure that Groups in Action Menus are rendered with the c…
Browse files Browse the repository at this point in the history
…orrect width
  • Loading branch information
Westbrook committed Oct 13, 2022
1 parent 0ca2880 commit a996a10
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
30 changes: 30 additions & 0 deletions packages/action-menu/stories/action-menu.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { html, TemplateResult } from '@spectrum-web-components/base';

import '@spectrum-web-components/menu/sp-menu.js';
import '@spectrum-web-components/menu/sp-menu-item.js';
import '@spectrum-web-components/menu/sp-menu-group.js';
import '@spectrum-web-components/menu/sp-menu-divider.js';
import { ActionMenuMarkup } from './';

import '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';
Expand Down Expand Up @@ -179,3 +181,31 @@ export const controlled = (): TemplateResult => {
<span id="state-json"></span>
`;
};

export const groups = (): TemplateResult => html`
<sp-action-menu open>
<sp-menu-group id="cms">
<span slot="header">cms</span>
<sp-menu-item value="updateAllSiteContent">
Update All Content
</sp-menu-item>
<sp-menu-item value="refreshAllXDs">Refresh All XDs</sp-menu-item>
</sp-menu-group>
<sp-menu-group id="ssg">
<span slot="header">ssg</span>
<sp-menu-item value="clearCache">Clear Cache</sp-menu-item>
</sp-menu-group>
<sp-menu-group id="vrt">
<span slot="header">vrt</span>
<sp-menu-item value="vrt-contributions">Contributions</sp-menu-item>
<sp-menu-item value="vrt-internal">Internal</sp-menu-item>
<sp-menu-item value="vrt-public">Public</sp-menu-item>
<sp-menu-item value="vrt-patterns">Patterns</sp-menu-item>
<sp-menu-item value="vrt">All</sp-menu-item>
</sp-menu-group>
<sp-menu-divider></sp-menu-divider>
<sp-menu-group id="misc">
<sp-menu-item value="logout">Logout</sp-menu-item>
</sp-menu-group>
</sp-action-menu>
`;
11 changes: 11 additions & 0 deletions packages/menu/src/menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ governing permissions and limitations under the License.
@import './spectrum-menu.css';

:host {
/**
* Remove when Spectrum CSS supports this correctly
*/
display: inline-flex;
flex-direction: column;

/**
* TODO: remove the following when https://github.com/adobe/spectrum-css/issues/1130
is correct
Expand All @@ -34,5 +40,10 @@ governing permissions and limitations under the License.
}

::slotted(*) {
/**
* Remove when Spectrum CSS supports this correctly
*/
flex-shrink: 0;

--swc-menu-width: 100%;
}

0 comments on commit a996a10

Please # to comment.