Dotclear

Ticket #2267 (closed enhancement: fixed)

Opened 8 years ago

Last modified 7 years ago

Add title on active page in navigation

Reported by: tomek Owned by: team
Priority: low Milestone: 2.14
Component: module:plugins Version: 2.13
Severity: trivial Keywords: a11y, navigation
Cc:

Description

Refering to RGAA 12.12 criteria :  http://references.modernisation.gouv.fr/referentiel/criteres.html#liens It could be nice to add a "active page" / "page active" mention in the title of the active page / category / post when present in the main navigation (simple menu at least, could also be in pages + categories widgets if relevant).

Change History

comment:1 Changed 7 years ago by franck

Could you be more precise, may be with an example, I don't really understand what is requested!

comment:2 Changed 7 years ago by tomek

First it's a AAA level, so not top priority.
We know that a change in navigation must not be only visible with a change of colour. For instance, look at this page:  https://www.parc-expositions-autun.com/eduen-pratique/nos-espaces
The first entry of sub navigation has a darker background (current page), but is not accessible for everyone to notice. So if you hover it, you'll see a title with the name of the page and "rubrique active" right after.

Last edited 7 years ago by tomek (previous) (diff)

comment:3 Changed 7 years ago by franck

Briefly you want:

<ul id="sn-top" class="simple-menu supranav nosmall">
  <li class="li1 li-first"><a href="/"><span class="simple-menu-label">Accueil</span></a></li>
  <li class="li2 active"><a href="?archive" title="Page active"><span class="simple-menu-label">Archives</span></a></li>
  <li class="li3"><a href="?contact"><span class="simple-menu-label">Contactez-moi</span></a></li>
  <li class="li4 li-last"><a href="?pages/Mentions-legales"><span class="simple-menu-label">Mentions légales</span></a></li>
</ul>

With a title="Page active" for the second link of the list.

Meanwhile and waiting the fix for this request, you can already use the publicSimpleMenuItem behaviour to set the according title testing if the given arg has class element set to true; not so complicated to develop ;-)

comment:4 Changed 7 years ago by franck

Example of _public.php :

<?php
namespace themes\myTheme;

if (!defined('DC_RC_PATH')) {return;}

$core->addBehavior('publicSimpleMenuItem', array(__NAMESPACE__ . '\behaviorPublic', 'publicSimpleMenuItem'));

class behaviorPublic
{
    /**
     * Add a title on active menu item
     *
     * @param      integer  $i     index of menu item (0 based)
     * @param      variant  $item  item properties
     *                     'url' => URL
     *                     'label' <a> link label
     *                     'title' <a> link title (optional)
     *                     'span' description (will be displayed after <a> link)
     *                     'active' status (true/false)
     *                     'class' additional <li> class (optional)
     */
    public static function publicSimpleMenuItem($i, $item)
    {
        if ($item['active']) {
            $item['title'] = ($item['title'] ?: '') . __('Active page');
        }
    }
}

comment:5 Changed 7 years ago by tomek

Had not time to try that you already gave the answer! Cool! :-)

comment:6 Changed 7 years ago by franck

Beware, my example had not be tested ;-)

comment:7 Changed 7 years ago by franck

  • Milestone set to 2.14

comment:8 Changed 7 years ago by franck <carnet.franck.paul@…>

  • Status changed from new to closed
  • Resolution set to fixed

(In [5e5627d21aa3]) simpleMenu : set title to "Active page" or add " (active page)" for current simpleMenu active item link, closes #2267

Note: See TracTickets for help on using tickets.

Sites map