mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-28 16:10:55 +00:00
edb4385345
A list that toggles visibility via the checkbox hack is needed in at least two spots: the page actions overflow menu and the user menu. This patch makes several refactors to turn what was previously hardcoded into page actions a reusable component: - Start a new components directory. Components are reusable and composable. The subdirectories are organized by function, not ResourceLoader module bundling which greatly improves the ability to see a component's full functionality in one directory instead of examining the entire codebase. See updates to README. - Extract pageactions.less into: - ToggleList.less: LESS for any checkbox hack list. - DropDownList.less: LESS for lists that open downwards. - MenuListItem.less: LESS for list items of menus. The division makes it easier to see concerns, dependencies, and change code. - Move pageActionMenu.mustache to a component and extract ToggleList template. - Extract ToggleList.js from Toolbar.js. Bug: T214540 Change-Id: I171831469a6733c458bc5c7ba249a5096ca975b8
52 lines
1.5 KiB
Plaintext
52 lines
1.5 KiB
Plaintext
@import '../../minerva.less/minerva.variables';
|
|
|
|
.toggle-list__checkbox {
|
|
// Always occlude the checkbox. The checkbox display cannot be none since its focus state is used
|
|
// for other selectors.
|
|
position: absolute;
|
|
z-index: @z-indexOccluded;
|
|
opacity: 0;
|
|
}
|
|
|
|
.toggle-list__toggle {
|
|
// Use the hand icon for the toggle button which is actually a checkbox label.
|
|
cursor: pointer;
|
|
}
|
|
|
|
.toggle-list__checkbox:focus + .toggle-list__toggle {
|
|
// The toggle button / label itself cannot receive focus but the underlying checkbox can. Keep
|
|
// the button and checkbox focus presentation in sync. From
|
|
// resources/src/mediawiki.toc.styles/screen.less.
|
|
outline: dotted 1px; /* Firefox style for focus */
|
|
outline: auto @colorProgressiveHighlight; /* Webkit style for focus */
|
|
}
|
|
|
|
.touch-events .toggle-list__checkbox:focus + .toggle-list__toggle {
|
|
// Buttons have no focus outline on mobile.
|
|
outline: 0;
|
|
}
|
|
|
|
.toggle-list__list {
|
|
// The menu appears over the content and occupies no room within it.
|
|
position: absolute;
|
|
//
|
|
// If max-height is set and the height exceeds it, add a vertical scrollbar.
|
|
overflow-y: auto;
|
|
//
|
|
// The menu floats over content but below overlays.
|
|
z-index: @z-indexDrawer;
|
|
//
|
|
background: @skinContentBgColor;
|
|
box-shadow: 0 5px 17px 0 rgba( 0, 0, 0, 0.24 ), 0 0 1px @colorGray10;
|
|
border-radius: @borderRadius;
|
|
//
|
|
visibility: hidden;
|
|
opacity: 0;
|
|
}
|
|
|
|
.toggle-list__checkbox:checked ~ .toggle-list__list {
|
|
// Reveal the list when checked.
|
|
visibility: visible;
|
|
opacity: 1;
|
|
}
|