Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Navbar Review #7359

Closed
Closed
@cgack

Description

@cgack

Navbar Review

Description

A jQuery Mobile Widget that creates a row (bar) of buttons. The buttons are created from an unordered list of links wrapped in a container element with data-role=”navbar”. The buttons can contain text, icons, or text + icon.

Functional Specification

Navbar should extend the full available width of the viewport with a maximum number of buttons which, once reached, will:

  • "smart" stack the buttons. Not just in n rows of 2 columns, but in n rows of the maxbutton columns and then evenly distribute the remainder
  • if the morebutton option is set to true - trigger display of a "viewmore" button to indicate there are more buttons available. When "viewmore" is selected the remaining buttons will become visible in a popup. This morebutton functionality will be an extension to the navbar widget

Responsive Design Considerations

  • Ensure that the navbar adapts to various viewport sizes
  • possibly ensure that the default max number of buttons responds to relative screen size (i.e. 5 buttons for small/medium , 8 for larger layouts)
  • demo to highlight the ability to alter maxbuttons on throttledresize

Performance Considerations

Accessibility Considerations

Ensure that the navbar receives the role="navigation" attribute - spec

Navigation Considerations

Options

  • iconpos
    • sets the position of the icons
    • default: top
  • maxbuttons
    • sets the maximum number of buttons for the screen, i.e. 8 means each button takes 1/8th of the width
    • default: 5

morebutton extension

  • morebutton
    • tells the widget to use the view more extension functionality and button
    • default: false
  • morebuttontext
    • sets the text of the more button
    • default: "..."
  • morebuttoniconpos
    • sets the location of the optional icon on the more button
    • default: "top"
  • morebuttonicon
    • sets the icon to be used for the more button
    • default: null

Events

  • create triggered when a navbar is created

    
    $( ".selector" ).on("navbarcreate", function(event, ui) {});
    
    $( ".selector" ).navbar({
      create: function(event, ui) { }
    });
    

Methods

  • destroy removes navbar enhancements from the element

    $( ".selector" ).navbar( "destroy" );
    
  • refresh refreshes the navbar

$( ".selector" ).navbar( "refresh" );

Markup & Style

Initial Markup

<div class="selector" data-role="navbar" >
  <ul>
    <li><a href="#" class="ui-btn-active">Item 1</a></li>
      <li><a href="#">Item 2</a></li>
  </ul>
</div>

Enhanced Markup

<div role="navigation" class="selector ui-navbar" data-role="navbar">
  <ul class="ui-navbar-bar">
    <li class="ui-navbar-baritem"><a class="ui-link ui-btn ui-btn-active" href="#">Item 1</a></li>
    <li class="ui-navbar-baritem"><a class="ui-link ui-btn" href="#">Item 2</a></li>
  </ul>
</div>

CSS

.ui-navbar {
 max-width: 100%
}

.ui-navbar ul {
  padding: 0;
  display: table; 
  table-layout:fixed; 
  width: 100%;  
}

.ui-navbar li{
  display: table-cell;
  width: 100%;
}

Checklist

  • Widget avoids using document and window directly - uses this.document and this.window
  • Demos page
  • Demos page added to menu
  • Api PR #
  • update /js/index.php
  • update /js/jquery.mobile.js
  • check with download builder
  • Full test coverage
  • Device Testing
  • Screen reader testing
  • Full accessibility review by expert
  • add instructions to the upgrade guide

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions