From ac6a8500db9d92cf102b3d71f09dd961a05c8861 Mon Sep 17 00:00:00 2001 From: Matt Marjanovic Date: Sat, 1 Oct 2022 18:51:32 -0700 Subject: [PATCH] Move 'title' attribute of NavMenu toggles to the elements Currently, the 'title' attribute on a NavMenu section/item is placed on the top-level wrapper
element, instead of the dropdown-toggle's element. Everywhere else, 'title' attributes are placed directly on the element of the button/item/link. Since the top-level wrapper
encompasses the menu as well as the toggle, any items in the menu that do not have their own explicit 'title' attribute will inherit the top-level title. In other words, menu items that should not have tooltips will get the same tooltip as the dropdown-toggle. This commit moves the 'title' attribute in NavMenu off the top-level
and onto the toggle element. --- src/Components/NavMenu.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/NavMenu.php b/src/Components/NavMenu.php index bab6525c..ca1fb141 100644 --- a/src/Components/NavMenu.php +++ b/src/Components/NavMenu.php @@ -155,12 +155,12 @@ protected function buildDropdownMenuStub( $menuDescription ) { return $this->indent() . \Html::rawElement( 'div', [ 'class' => 'nav-item ' . $menuId . '-dropdown', - 'title' => Linker::titleAttrib( $menuId ) ], \Html::rawElement( 'a', [ 'href' => '#', 'class' => 'nav-link ' . $menuId . '-toggle', + 'title' => Linker::titleAttrib( $menuId ), ], htmlspecialchars( $menuDescription['header'] ) ) ); @@ -179,7 +179,6 @@ protected function buildDropdownOpeningTags( $menuDescription ) { $ret = $this->indent() . \Html::openElement( 'div', [ 'class' => 'nav-item dropdown ' . $menuId . '-dropdown', - 'title' => Linker::titleAttrib( $menuId ), ] ); // add the dropdown toggle @@ -190,6 +189,7 @@ protected function buildDropdownOpeningTags( $menuDescription ) { 'class' => 'nav-link dropdown-toggle ' . $menuId . '-toggle', 'data-toggle' => 'dropdown', 'data-boundary' => 'viewport', + 'title' => Linker::titleAttrib( $menuId ), ], htmlspecialchars( $menuDescription['header'] ) );