Skip to content

Commit

Permalink
Merge pull request #629 from tomusborne/tweak/prevent-dropdown-arrow-…
Browse files Browse the repository at this point in the history
…click

Tweak: Add CSS to prevent dropdown arrow click
  • Loading branch information
tomusborne authored Jul 25, 2024
2 parents fe3d935 + 2385d0a commit 234fefe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions inc/css-output.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ function generate_base_css() {

$css->set_selector( '.dropdown-click .sfHover > a > .dropdown-menu-toggle > .gp-icon svg' );
$css->add_property( 'transform', 'rotate(180deg)' );

if ( 'click' === generate_get_option( 'nav_dropdown_type' ) ) {
$css->set_selector( '.menu-item-has-children .dropdown-menu-toggle[role="presentation"]' );
$css->add_property( 'pointer-events', 'none' );
}
}

$css->set_selector( ':root' );
Expand Down
7 changes: 1 addition & 6 deletions inc/structure/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ function generate_dropdown_icon_to_menu_link( $title, $item, $args, $depth ) {
$role = 'presentation';
$tabindex = '';
$aria_label = '';
$style = '';

if ( 'click-arrow' === generate_get_option( 'nav_dropdown_type' ) ) {
$role = 'button';
Expand All @@ -379,10 +378,6 @@ function generate_dropdown_icon_to_menu_link( $title, $item, $args, $depth ) {
);
}

if ( 'click' === generate_get_option( 'nav_dropdown_type' ) ) {
$style = ' style="pointer-events: none;"';
}

if ( isset( $args->container_class ) && 'main-nav' === $args->container_class ) {
foreach ( $item->classes as $value ) {
if ( 'menu-item-has-children' === $value ) {
Expand Down Expand Up @@ -427,7 +422,7 @@ function generate_dropdown_icon_to_menu_link( $title, $item, $args, $depth ) {
}

$icon = generate_get_svg_icon( 'arrow' . $arrow_direction );
$title = $title . '<span role="' . $role . '" class="dropdown-menu-toggle"' . $tabindex . $aria_label . $style . '>' . $icon . '</span>';
$title = $title . '<span role="' . $role . '" class="dropdown-menu-toggle"' . $tabindex . $aria_label . '>' . $icon . '</span>';
}
}
}
Expand Down

0 comments on commit 234fefe

Please sign in to comment.