MVVM WidgetContextMenu component to shared component (#31190)

* Create WidgetContextMenu component in shared-components

* Modify WidgetMenuContext call (apptile, extensioncard, widgetcard), test and stories

* Correctly use new widgetcontextmenu component

* WidgetContextMenuViewModel unit test

* Lint and add comments

* Finalize widgetcontextmenuviewmodel test

* fix lint errors

* Fix test error

* Update playwright screenshots

* add userWidget in widgetcontexstmenu props

* Fix some a11y issues on playwright

* fix linter error widget card

* Use new i18n way for share component widget context menu

* Add i18n context provider for widget context menu

* chore: lint and update snapshot widgetcontextmenu
This commit is contained in:
Marc
2026-01-29 11:22:47 +01:00
committed by GitHub
parent 8769165e88
commit 8bb1cb5e63
20 changed files with 1176 additions and 155 deletions

View File

@@ -26,24 +26,15 @@ exports[`AppTile destroys non-persisted right panel widget on room change 1`] =
aria-haspopup="true"
aria-label="Options"
class="mx_AccessibleButton mx_BaseCard_header_title_button--option"
data-state="closed"
id="radix-_r_0_"
role="button"
tabindex="0"
>
<svg
fill="currentColor"
height="1em"
viewBox="0 0 24 24"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M6 14q-.824 0-1.412-.588A1.93 1.93 0 0 1 4 12q0-.825.588-1.412A1.93 1.93 0 0 1 6 10q.824 0 1.412.588Q8 11.175 8 12t-.588 1.412A1.93 1.93 0 0 1 6 14m6 0q-.825 0-1.412-.588A1.93 1.93 0 0 1 10 12q0-.825.588-1.412A1.93 1.93 0 0 1 12 10q.825 0 1.412.588Q14 11.175 14 12t-.588 1.412A1.93 1.93 0 0 1 12 14m6 0q-.824 0-1.413-.588A1.93 1.93 0 0 1 16 12q0-.825.587-1.412A1.93 1.93 0 0 1 18 10q.824 0 1.413.588Q20 11.175 20 12t-.587 1.412A1.93 1.93 0 0 1 18 14"
/>
</svg>
</div>
type="button"
/>
</div>
<button
aria-labelledby="_r_0_"
aria-labelledby="_r_2_"
class="_icon-button_1215g_8"
data-kind="secondary"
data-testid="base-card-close-button"
@@ -185,8 +176,11 @@ exports[`AppTile for a pinned widget should render 1`] = `
aria-haspopup="true"
aria-label="Options"
class="mx_AccessibleButton mx_AppTileMenuBar_widgets_button"
data-state="closed"
id="radix-_r_1k_"
role="button"
tabindex="0"
type="button"
>
<svg
class="mx_Icon mx_Icon_12"
@@ -298,8 +292,11 @@ exports[`AppTile for a pinned widget should render permission request 1`] = `
aria-haspopup="true"
aria-label="Options"
class="mx_AccessibleButton mx_AppTileMenuBar_widgets_button"
data-state="closed"
id="radix-_r_30_"
role="button"
tabindex="0"
type="button"
>
<svg
class="mx_Icon mx_Icon_12"
@@ -352,8 +349,8 @@ exports[`AppTile for a pinned widget should render permission request 1`] = `
<span>
Using this widget may share data
<div
aria-describedby="_r_2f_"
aria-labelledby="_r_2e_"
aria-describedby="_r_33_"
aria-labelledby="_r_32_"
class="mx_TextWithTooltip_target mx_TextWithTooltip_target--helpIcon"
>
<svg
@@ -490,8 +487,11 @@ exports[`AppTile preserves non-persisted widget on container move 1`] = `
aria-haspopup="true"
aria-label="Options"
class="mx_AccessibleButton mx_AppTileMenuBar_widgets_button"
data-state="closed"
id="radix-_r_10_"
role="button"
tabindex="0"
type="button"
>
<svg
class="mx_Icon mx_Icon_12"

View File

@@ -288,26 +288,4 @@ exports[`<ExtensionsCard /> should render widgets 1`] = `
</DocumentFragment>
`;
exports[`<ExtensionsCard /> should show context menu on widget row 1`] = `
<ul
class="mx_IconizedContextMenu"
role="none"
>
<div
class="mx_IconizedContextMenu_optionList mx_IconizedContextMenu_optionList_notFirst"
>
<li
aria-label="Remove for everyone"
class="mx_AccessibleButton mx_IconizedContextMenu_item"
role="menuitem"
tabindex="0"
>
<span
class="mx_IconizedContextMenu_label"
>
Remove for everyone
</span>
</li>
</div>
</ul>
`;
exports[`<ExtensionsCard /> should show context menu on widget row 1`] = `null`;