diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 0549efe82e..60dbf55eae 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -630,35 +630,6 @@ function template_preprocess_datetime_wrapper(&$variables) {
$variables['content'] = $element['#children'];
}
-/**
- * Prepares variables for an operation list template.
- *
- * Default template: operation-list.html.twig.
- *
- * @param array $variables
- * An associative array containing:
- * - operations: An array of render elements that will be displayed in a list.
- * This element can be a submit, button, or link render element. All other
- * items will be filtered from the array.
- * - attributes: A keyed array of attributes for the
containing the list
- * of operations.
- * - list_item_attributes: A keyed array of attributes for the - containing
- * each operation.
- */
-function template_preprocess_operation_list(array &$variables) {
- $operations = $variables['operations'];
- $variables['list_item_attributes'] = new Attribute($variables['list_item_attributes']);
-
- if (!empty($operations)) {
- $elements = ['submit', 'button', 'link'];
- foreach ($operations as $key => $operation) {
- if (isset($operation['#type']) && in_array($operation['#type'], $elements)) {
- $variables['items'][] = $operation;
- }
- }
- }
-}
-
/**
* Prepares variables for links templates.
*
@@ -1204,6 +1175,59 @@ function template_preprocess_item_list(&$variables) {
}
}
+/**
+ * Prepares variables for inclusion in a splitbutton item list.
+ *
+ * @param array $variables
+ * An associative array containing:
+ * - items: An array of items to be displayed in the list.
+ * - list_type: The type of list to return (e.g. "ul", "ol").
+ * - wrapper_attributes: HTML attributes to be applied to the list wrapper.
+ */
+function template_preprocess_splitbutton_item_list(array &$variables) {
+ $variables['wrapper_attributes'] = new Attribute($variables['wrapper_attributes']);
+ foreach ($variables['items'] as &$item) {
+ $attributes = [];
+ // If the item value is an array, then it is a render array.
+ if (is_array($item)) {
+ // List items support attributes via the '#wrapper_attributes' property.
+ if (isset($item['#wrapper_attributes'])) {
+ $attributes = $item['#wrapper_attributes'];
+ }
+ }
+
+ // Set the item's value and attributes for the template.
+ $item = [
+ 'value' => $item,
+ 'attributes' => new Attribute($attributes),
+ ];
+ }
+}
+
+/**
+ * Prepares variables for splitbutton templates.
+ *
+ * @param array $variables
+ * An associative array containing:
+ * - main_element: A render array of either a link, button, or submit element.
+ * This is the element that is always visible in a splitbutton.
+ * - variants: An array of strings defined in #splitbutton_type, used for
+ * adding type-specific classes to elements within the splitbutton.
+ * - attributes: The attributes added to the splitbutton container.
+ * - toggle_attributes: The attributes added to the toggle button.
+ * - splitbutton_item_list: an array of render elements that will populate the
+ * list items.
+ * - title: This is a string that, when present, instructs splitbutton to
+ * function like a dropdown. This becomes the label of the main element, and
+ * this main element is what toggles the item list.
+ * - exclude_toggle: Boolean that defaults to FALSE. When TRUE, this will
+ * prevent a dedicated toggle button from rendering. This is for elements
+ * that extend splitbutton that don't necessarily want the toggle button.
+ */
+function template_preprocess_splitbutton(array &$variables) {
+ $variables['toggle_attributes'] = new Attribute($variables['toggle_attributes']);
+}
+
/**
* Prepares variables for container templates.
*
@@ -2037,9 +2061,6 @@ function drupal_common_theme() {
'links' => [
'variables' => ['links' => [], 'attributes' => ['class' => ['links']], 'heading' => [], 'set_active_class' => FALSE],
],
- 'operation_list' => [
- 'variables' => ['attributes' => [], 'operations' => NULL, '#theme' => 'operation_list', 'list_item_attributes' => []],
- ],
'dropbutton_wrapper' => [
'variables' => ['children' => NULL],
],
@@ -2074,6 +2095,26 @@ function drupal_common_theme() {
'item_list' => [
'variables' => ['items' => [], 'title' => '', 'list_type' => 'ul', 'wrapper_attributes' => [], 'attributes' => [], 'empty' => NULL, 'context' => []],
],
+ 'splitbutton_item_list' => [
+ 'variables' => [
+ 'items' => [],
+ 'list_type' => 'ul',
+ 'wrapper_attributes' => [],
+ 'attributes' => [],
+ ],
+ ],
+ 'splitbutton' => [
+ 'variables' => [
+ 'splitbutton_multiple' => TRUE,
+ 'main_element' => NULL,
+ 'variants' => [],
+ 'attributes' => [],
+ 'toggle_attributes' => [],
+ 'splitbutton_item_list' => [],
+ 'title' => NULL,
+ 'exclude_toggle' => FALSE,
+ ],
+ ],
'feed_icon' => [
'variables' => ['url' => NULL, 'title' => NULL],
],
diff --git a/core/lib/Drupal/Core/Render/Element/OperationList.php b/core/lib/Drupal/Core/Render/Element/OperationList.php
deleted file mode 100644
index 7a2f6027ce..0000000000
--- a/core/lib/Drupal/Core/Render/Element/OperationList.php
+++ /dev/null
@@ -1,22 +0,0 @@
- 'operation_list',
- '#operations' => [],
- ];
- }
-
-}
diff --git a/core/lib/Drupal/Core/Render/Element/Splitbutton.php b/core/lib/Drupal/Core/Render/Element/Splitbutton.php
index 341dc0f174..85d3f1d2ca 100644
--- a/core/lib/Drupal/Core/Render/Element/Splitbutton.php
+++ b/core/lib/Drupal/Core/Render/Element/Splitbutton.php
@@ -9,9 +9,10 @@
* Provides a form element for a toggleable menu button.
*
* Properties:
- * - #splitbutton_items: Items that will be themed as an operations_list. This
- * can include submit, link and button. All other elements will be filtered
- * out.
+ * - #splitbutton_items: Items that will be themed as a splitbutton_item_list.
+ * By default, the items can be of the following types: submit, link and
+ * button. All other elements will be filtered out. Elements extending this
+ * class can change the items that are filtered by overriding filterItems().
* - #splitbutton_type: A string or an array or strings defining a type of
* dropbutton variant for styling purposes. This adds the class
* `splitbutton--#splitbutton_type` to the splitbutton wrapper and the class
@@ -19,6 +20,12 @@
* - #title: This changes the default splitbutton behavior of displaying a
* primary splitbutton item next a separate toggle button. When this property
* is present, there is no primary item, just a toggle.
+ * - #exclude_toggle: Defaults to FALSE. Largely used by render elements
+ * extending splitbutton. When TRUE, no toggle button is added even if the
+ * configuration would typically result in its addition. For these uses, it
+ * should be confirmed that there is still an element with the
+ * `data-drupal-splitbutton-trigger` attribute, as it is necessary for
+ * splitbutton's JavaScript.
*
* Deprecated Properties:
* - #links: An array of links to actions. See template_preprocess_links() for
@@ -30,7 +37,7 @@
*
* @RenderElement("splitbutton")
*/
-class Splitbutton extends RenderElement {
+class Splitbutton extends FormElement {
use StringTranslationTrait;
@@ -43,12 +50,9 @@ public function getInfo() {
'#pre_render' => [
[$class, 'preRenderSplitbutton'],
],
- '#theme_wrappers' => [
- 'container' => [
- '#attributes' => [
- 'class' => ['splitbutton' , 'js-splitbutton'],
- ],
- ],
+ '#theme_wrappers' => ['splitbutton'],
+ '#attached' => [
+ 'library' => 'core/drupal.splitbutton',
],
];
}
@@ -63,34 +67,61 @@ public function getInfo() {
* Render array.
*/
public static function preRenderSplitbutton(array $element) {
- $element['#attached']['library'][] = 'core/drupal.splitbutton';
-
- if (isset($element['#attributes'])) {
- $element['#theme_wrappers']['container']['#attributes'] += $element['#attributes'];
- }
-
- $splitbutton_types = [];
+ $element['#variants'] = [];
if (!empty($element['#splitbutton_type'])) {
// If #splitbutton_type exists and it is a string, place it in an array.
- $splitbutton_types = is_array($element['#splitbutton_type']) ? $element['#splitbutton_type'] : [$element['#splitbutton_type']];
+ $element['#variants'] = is_array($element['#splitbutton_type']) ? $element['#splitbutton_type'] : [$element['#splitbutton_type']];
};
if (!empty($element['#dropbutton_type'])) {
@trigger_error("The #dropbutton_type property in splitbutton is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0.", E_USER_DEPRECATED);
- $splitbutton_types[] = $element['#dropbutton_type'];
+ $element['#variants'][] = $element['#dropbutton_type'];
+ }
+
+ $trigger_id = Html::getUniqueId('splitbutton');
+ $element['#trigger_id'] = $trigger_id;
+
+ $items = static::collectItems($element);
+ static::buildToggleAttributes($element);
+
+ // If the #title property is not present, splitbutton takes the first item
+ // from the $items array and makes that the main "button". A dedicated
+ // toggle button is also provided in these instances.
+ if (!isset($element['#title'])) {
+ $first_item = array_shift($items);
+ $element['#main_element'] = $first_item;
+ static::addMainElementClasses($element, $first_item['#type']);
+ $element['#toggle_attributes']['#attributes']['aria-label'] = t('List additional actions');
}
- // Add modifier class to wrapper.
- foreach ($splitbutton_types as $container_splitbutton_type) {
- $element['#theme_wrappers']['container']['#attributes']['class'][] = 'splitbutton--' . $container_splitbutton_type;
+ // If additional items are present, place them in a splitbutton list.
+ if (count($items)) {
+ static::buildItemList($element, $items);
+ $element['#splitbutton_multiple'] = TRUE;
+ }
+ else {
+ $element['#splitbutton_multiple'] = FALSE;
}
+ return $element;
+ }
+
+ /**
+ * Collects items that will be added to the splitbutton.
+ *
+ * @param array $element
+ * The render element.
+ */
+ public static function collectItems(array $element) {
$items = $element['#splitbutton_items'] ?? [];
+ // The #links property was used by dropbuttons. To facilitate an easier
+ // switch from dropbutton to splitbutton, items in a #links array are
+ // converted to `link` render elements with a #type, and added to the list
+ // of splitbutton elements.
if (isset($element['#links'])) {
@trigger_error("The #links property in splitbutton is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0.", E_USER_DEPRECATED);
-
foreach ($element['#links'] as &$op) {
if (isset($op['url']) && isset($op['title'])) {
$op['#url'] = $op['url'];
@@ -103,93 +134,110 @@ public static function preRenderSplitbutton(array $element) {
$items += $element['#links'];
}
- $element['trigger'] = [
- '#type' => 'container',
- '#attributes' => [
- 'class' => [
- 'splitbutton__main',
- ],
- ],
+ static::filterItems($items);
+ return $items;
+ }
+
+ /**
+ * Adds attributes used for the toggle button.
+ *
+ * @param array $element
+ * The render element.
+ */
+ public static function buildToggleAttributes(array &$element) {
+ $trigger_id = $element['#trigger_id'];
+ $element['#toggle_attributes'] = [
+ 'class' => ['button', 'splitbutton__toggle'],
+ 'type' => 'button',
+ 'role' => 'button',
+ 'aria-haspopup' => 'true',
+ 'aria-controls' => "$trigger_id-menu",
+ 'aria-expanded' => 'false',
+ 'id' => "$trigger_id-trigger",
+ 'data-drupal-splitbutton-trigger' => $trigger_id,
];
+ }
- $trigger_id = Html::getUniqueId('splitbutton');
+ /**
+ * Adds list items to the splitbutton.
+ *
+ * @param array $element
+ * The render element.
+ * @param array $items
+ * An array of elements to be added.
+ */
+ public static function buildItemList(array &$element, array $items) {
+ $trigger_id = $element['#trigger_id'];
+
+ foreach ($items as &$item) {
+ // Classes must be added here instead of in templates as the item could
+ // be one of several different render element types.
+ $item['#attributes']['class'][] = 'splitbutton__operation-list-item';
+ $item['#attributes']['role'] = 'menuitem';
+ $item['#attributes']['tabindex'] = '-1';
+ $item['#wrapper_attributes']['role'] = 'none';
+ }
- $toggle_element = [
- '#type' => 'html_tag',
- '#tag' => 'button',
+ $element['#splitbutton_item_list'] = [
+ '#items' => $items,
+ '#theme' => 'splitbutton_item_list',
'#attributes' => [
- 'class' => ['button', 'splitbutton__toggle'],
- 'type' => 'button',
- 'role' => 'button',
- 'aria-haspopup' => 'true',
- 'aria-controls' => "$trigger_id-menu",
- 'aria-expanded' => 'false',
- 'id' => "$trigger_id-trigger",
- 'data-splitbutton-trigger' => $trigger_id,
+ 'data-drupal-splitbutton-target' => $trigger_id,
+ 'role' => 'menu',
+ 'aria-labelledby' => "$trigger_id-trigger",
+ 'id' => "$trigger_id-menu",
],
];
+ }
- // If the #title property is present, Splitbutton has a single main button
- // that toggles the operations list instead of a link/button accompanied by
- // a separate toggle.
- if (isset($element['#title'])) {
- $element['trigger']['title'] = $toggle_element;
- $element['trigger']['title']['#attributes']['class'][] = 'splitbutton__toggle--with-title';
- $element['trigger']['title']['value']['#markup'] = $element['#title'];
- }
- else {
- $first_item = array_shift($items);
- $element['trigger']['title'] = $first_item;
- $element['trigger']['title']['#attributes']['class'][] = 'button';
- $element['trigger']['title']['#attributes']['class'][] = 'splitbutton__main-button';
- $element['trigger']['title']['#attributes']['class'][] = 'splitbutton__main-button--' . $first_item['#type'];
-
- // If there are additional items, add a toggle for their visibility.
- if (count($items)) {
- $element['trigger']['toggle'] = $toggle_element;
- $element['trigger']['toggle']['#value'] = '';
- $element['trigger']['toggle']['#attributes']['class'][] = 'splitbutton__toggle--no-title';
- $element['trigger']['toggle']['#attributes']['aria-label'] = t('List additional actions');
- foreach ($splitbutton_types as $toggle_splitbutton_type) {
- $element['trigger']['toggle']['#attributes']['class'][] = 'button--' . $toggle_splitbutton_type;
- }
+ /**
+ * Filters unsupported element types from a splitbutton item list.
+ *
+ * @param array $items
+ * The splitbutton list items.
+ *
+ * @return array
+ * An array of only immediate children that match specific render element
+ * types.
+ */
+ public static function filterItems(array $items) {
+ $allowed_types = ['submit', 'button', 'link'];
+ foreach ($items as $item) {
+ if (!isset($item['#type']) || !in_array($item['#type'], $allowed_types)) {
+ throw new \LogicException('Splitbutton item is either missing #type, or #type is not submit, button or link.');
}
}
+ }
- // Add modifier classes based on #splitbutton_type to the main button.
- foreach ($splitbutton_types as $main_splitbutton_type) {
- $element['trigger']['title']['#attributes']['class'][] = 'button--' . $main_splitbutton_type;
+ /**
+ * Adds classes to the main splitbutton input.
+ *
+ * By default, the main splitbutton input is styled as a button, regardless of
+ * its element type. Elements that extend splitbutton may wish to style these
+ * elements differently, so this is available as a targeted, overridable
+ * function.
+ *
+ * @param array $element
+ * The splitbutton render array.
+ * @param null|string $modifier
+ * A modifier that can be used for adding additional classes.
+ */
+ public static function addMainElementClasses(array &$element, $modifier = NULL) {
+ // Classes must be added here instead of templates as the main button can be
+ // be one of several render element types.
+ $element['#main_element']['#attributes']['class'][] = 'splitbutton__main-button';
+ if (!empty($modifier)) {
+ $element['#main_element']['#attributes']['class'][] = 'splitbutton__main-button--' . $modifier;
}
- // If additional items are present, place them in an operation list.
- if (count($items)) {
- $element['#theme_wrappers']['container']['#attributes']['class'][] = 'splitbutton--multiple';
- $element['#theme_wrappers']['container']['#attributes']['class'][] = 'js-splitbutton-multiple';
- foreach ($items as &$item) {
- $item['#attributes']['class'][] = 'splitbutton__operation-list-item';
- $item['#attributes']['role'] = 'menuitem';
- $item['#attributes']['tabindex'] = '-1';
- }
- $element['operation_list'] = [
- '#operations' => $items,
- '#theme' => 'operation_list',
- '#list_item_attributes' => [
- 'role' => 'none',
- ],
- '#attributes' => [
- 'class' => ['splitbutton__operation-list'],
- 'data-splitbutton-target' => $trigger_id,
- 'role' => 'menu',
- 'aria-labelledby' => "$trigger_id-trigger",
- 'id' => "$trigger_id-menu",
- ],
- ];
- }
- else {
- $element['#theme_wrappers']['container']['#attributes']['class'][] = 'splitbutton--single';
- }
+ // The main splitbutton element will always be styled as a button,
+ // regardless of its actual type.
+ $element['#main_element']['#attributes']['class'][] = 'button';
- return $element;
+ // Add variant classes based on #splitbutton_type to the main button.
+ foreach ($element['#variants'] as $variant) {
+ $element['#main_element']['#attributes']['class'][] = 'button--' . $variant;
+ }
}
}
diff --git a/core/misc/splitbutton/splitbutton.css b/core/misc/splitbutton/splitbutton.css
index bb976aa577..a693cc4499 100644
--- a/core/misc/splitbutton/splitbutton.css
+++ b/core/misc/splitbutton/splitbutton.css
@@ -36,6 +36,42 @@
text-decoration: none;
}
+.splitbutton__toggle {
+ position: relative;
+}
+
+.splitbutton__toggle::after {
+ position: absolute;
+ top: 50%;
+ right: 6px; /* LTR */
+ width: 0;
+ height: 0;
+ content: "";
+ transform: translate(50%, -50%) rotate(0);
+ border-width: 0.3333em 0.3333em 0;
+ border-style: solid;
+ border-right-color: transparent;
+ border-bottom-color: transparent;
+ border-left-color: transparent;
+}
+[dir="rtl"] .splitbutton__toggle::after {
+ right: auto;
+ left: 6px;
+}
+.splitbutton.open .splitbutton__toggle::after {
+ top: 48%;
+ transform: translate(50%, -50%) rotate(180deg);
+}
+
+.splitbutton__toggle--with-title {
+ position: relative;
+ padding-right: 15px; /* LTR */
+}
+[dir="rtl"] .splitbutton__toggle--with-title {
+ padding-right: 6px;
+ padding-left: 15px;
+}
+
html:not(.js) .splitbutton__toggle {
display: none;
}
diff --git a/core/misc/splitbutton/splitbutton.es6.js b/core/misc/splitbutton/splitbutton.es6.js
index 7bdde8ec09..80f1cf8c47 100644
--- a/core/misc/splitbutton/splitbutton.es6.js
+++ b/core/misc/splitbutton/splitbutton.es6.js
@@ -29,8 +29,10 @@
this.firstChars = [];
this.splitbutton = splitbutton;
- this.trigger = splitbutton.querySelector('[data-splitbutton-trigger]');
- this.menu = splitbutton.querySelector('[data-splitbutton-target]');
+ this.trigger = splitbutton.querySelector(
+ '[data-drupal-splitbutton-trigger]',
+ );
+ this.menu = splitbutton.querySelector('[data-drupal-splitbutton-target]');
this.triggerContainer = splitbutton.querySelector('.splitbutton__main');
this.splitbutton.addEventListener('mouseenter', () => this.activeIn());
@@ -47,15 +49,17 @@
initMenuItems() {
// If this.menuItems is empty, the initialization hasn't occurred yet.
if (this.menuItems.length === 0) {
+ const itemTags =
+ this.menu.getAttribute('data-drupal-item-tags') || 'a, input, button';
Array.prototype.slice
- .call(this.menu.querySelectorAll('input, a, button'))
+ .call(this.menu.querySelectorAll(itemTags))
.forEach((item, index) => {
// Add attribute to each item to identify its focus order.
- item.setAttribute('data-splitbutton-item', index);
+ item.setAttribute('data-drupal-splitbutton-item', index);
this.menuItems.push(item);
const itemText =
- item.tagName === 'A'
+ item.tagName === 'A' || item.tagName === 'LI'
? item.textContent
: item.getAttribute('value');
@@ -185,7 +189,7 @@
e.keyCode === this.keyCode.SPACE ||
e.keyCode === this.keyCode.RETURN ||
(e.keyCode === this.keyCode.TAB &&
- e.target.getAttribute('data-splitbutton-item') === null)
+ e.target.getAttribute('data-drupal-splitbutton-item') === null)
) {
return;
}
@@ -206,7 +210,6 @@
break;
case this.keyCode.DOWN:
- this.focusNext(e);
if (this.splitbutton.classList.contains('open')) {
this.focusNext(e);
} else {
@@ -255,7 +258,7 @@
* A keydown event.
*/
focusNext(e) {
- const currentItem = e.target.getAttribute('data-splitbutton-item');
+ const currentItem = e.target.getAttribute('data-drupal-splitbutton-item');
if (currentItem === null) {
this.menuItems[0].focus();
} else {
@@ -272,7 +275,7 @@
* A keydown event.
*/
focusPrev(e) {
- const currentItem = e.target.getAttribute('data-splitbutton-item');
+ const currentItem = e.target.getAttribute('data-drupal-splitbutton-item');
if (currentItem === null) {
this.menuItems[this.lastItemIndex].focus();
} else {
@@ -312,7 +315,7 @@
* The character being searched for
*/
setFocusByFirstCharacter(e, char) {
- const currentItem = e.target.getAttribute('data-splitbutton-item');
+ const currentItem = e.target.getAttribute('data-drupal-splitbutton-item');
// Get start index for search based on position of current item.
let start = currentItem === null ? parseInt(currentItem, 10) + 1 : 0;
if (start === this.menuItems.length) {
diff --git a/core/misc/splitbutton/splitbutton.js b/core/misc/splitbutton/splitbutton.js
index 8ff26f37dd..cc3e6e68bd 100644
--- a/core/misc/splitbutton/splitbutton.js
+++ b/core/misc/splitbutton/splitbutton.js
@@ -36,8 +36,8 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
this.menuItems = [];
this.firstChars = [];
this.splitbutton = splitbutton;
- this.trigger = splitbutton.querySelector('[data-splitbutton-trigger]');
- this.menu = splitbutton.querySelector('[data-splitbutton-target]');
+ this.trigger = splitbutton.querySelector('[data-drupal-splitbutton-trigger]');
+ this.menu = splitbutton.querySelector('[data-drupal-splitbutton-target]');
this.triggerContainer = splitbutton.querySelector('.splitbutton__main');
this.splitbutton.addEventListener('mouseenter', function () {
return _this.activeIn();
@@ -65,12 +65,13 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
var _this2 = this;
if (this.menuItems.length === 0) {
- Array.prototype.slice.call(this.menu.querySelectorAll('input, a, button')).forEach(function (item, index) {
- item.setAttribute('data-splitbutton-item', index);
+ var itemTags = this.menu.getAttribute('data-drupal-item-tags') || 'a, input, button';
+ Array.prototype.slice.call(this.menu.querySelectorAll(itemTags)).forEach(function (item, index) {
+ item.setAttribute('data-drupal-splitbutton-item', index);
_this2.menuItems.push(item);
- var itemText = item.tagName === 'A' ? item.textContent : item.getAttribute('value');
+ var itemText = item.tagName === 'A' || item.tagName === 'LI' ? item.textContent : item.getAttribute('value');
_this2.firstChars.push(itemText.trim().substring(0, 1).toLowerCase());
@@ -163,7 +164,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
var preventDefault = true;
var char = e.key;
- if (e.ctrlKey || e.altKey || e.metaKey || e.keyCode === this.keyCode.SPACE || e.keyCode === this.keyCode.RETURN || e.keyCode === this.keyCode.TAB && e.target.getAttribute('data-splitbutton-item') === null) {
+ if (e.ctrlKey || e.altKey || e.metaKey || e.keyCode === this.keyCode.SPACE || e.keyCode === this.keyCode.RETURN || e.keyCode === this.keyCode.TAB && e.target.getAttribute('data-drupal-splitbutton-item') === null) {
return;
}
@@ -184,11 +185,11 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
break;
case this.keyCode.DOWN:
- this.focusNext(e);
-
if (this.splitbutton.classList.contains('open')) {
+ console.log('focusnext');
this.focusNext(e);
} else {
+ console.log('open, then focus first');
this.open();
this.focusFirst();
}
@@ -228,7 +229,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
}, {
key: "focusNext",
value: function focusNext(e) {
- var currentItem = e.target.getAttribute('data-splitbutton-item');
+ var currentItem = e.target.getAttribute('data-drupal-splitbutton-item');
if (currentItem === null) {
this.menuItems[0].focus();
@@ -241,7 +242,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
}, {
key: "focusPrev",
value: function focusPrev(e) {
- var currentItem = e.target.getAttribute('data-splitbutton-item');
+ var currentItem = e.target.getAttribute('data-drupal-splitbutton-item');
if (currentItem === null) {
this.menuItems[this.lastItemIndex].focus();
@@ -269,7 +270,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
}, {
key: "setFocusByFirstCharacter",
value: function setFocusByFirstCharacter(e, char) {
- var currentItem = e.target.getAttribute('data-splitbutton-item');
+ var currentItem = e.target.getAttribute('data-drupal-splitbutton-item');
var start = currentItem === null ? parseInt(currentItem, 10) + 1 : 0;
if (start === this.menuItems.length) {
diff --git a/core/modules/system/templates/operation-list.html.twig b/core/modules/system/templates/operation-list.html.twig
deleted file mode 100644
index 255dbecc29..0000000000
--- a/core/modules/system/templates/operation-list.html.twig
+++ /dev/null
@@ -1,21 +0,0 @@
-{#
-/**
- * @file
- * Default theme implementation for an operation list.
- *
- * Available variables:
- * - attributes: Attributes for the