Skip to content

Commit 49afa5f

Browse files
committed
Improve timestamp; fix issue #13
1 parent c2f1ecd commit 49afa5f

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "pretty-dropdowns",
33
"description": "A simple, lightweight jQuery plugin to create stylized drop-down menus.",
4-
"version": "4.13.0",
4+
"version": "4.15.0",
55
"main": [
66
"dist/css/prettydropdowns.css",
77
"dist/js/jquery.prettydropdowns.js"

dist/js/jquery.prettydropdowns.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* jQuery Pretty Dropdowns Plugin v4.13.0 by T. H. Doan (https://thdoan.github.io/pretty-dropdowns/)
2+
* jQuery Pretty Dropdowns Plugin v4.15.0 by T. H. Doan (https://thdoan.github.io/pretty-dropdowns/)
33
*
44
* jQuery Pretty Dropdowns by T. H. Doan is licensed under the MIT License.
55
* Read a copy of the license in the LICENSE file or at https://choosealicense.com/licenses/mit/
@@ -58,7 +58,7 @@
5858
$select.data('size', nSize).removeAttr('size');
5959
// Set <select> height to reserve space for <div> container
6060
$select.css('visibility', 'hidden').outerHeight(oOptions.height);
61-
nTimestamp = +new Date();
61+
nTimestamp = performance.now()*100000000000000;
6262
// Test whether to add 'aria-labelledby'
6363
if (elSel.id) {
6464
// Look for <label>
@@ -420,18 +420,22 @@
420420
if ($dropdown.hasClass('reverse') && !oOptions.classic) $dropdown.prepend($dropdown.children(':last-child'));
421421
$dropdown.removeClass('active reverse').removeData('clicked').attr('aria-expanded', 'false').css('height', '');
422422
$dropdown.children().removeClass('hover nohover');
423+
// Update focus for NVDA screen readers
424+
$dropdown.attr('aria-activedescendant', $dropdown.children('.selected').attr('id'));
423425
}, (o.type==='mouseleave' && !$dropdown.data('clicked')) ? oOptions.hoverIntent : 0);
424426
},
425427

426428
// Set menu item hover state
427429
// bNoScroll set on hoverDropdownItem()
428430
toggleHover = function($li, bOn, bNoScroll) {
429431
if (bOn) {
432+
var $dropdown = $li.parent();
430433
$li.removeClass('nohover').addClass('hover');
434+
// Update focus for NVDA screen readers
435+
$dropdown.attr('aria-activedescendant', $li.attr('id'));
431436
if ($li.length===1 && $current && !bNoScroll) {
432437
// Ensure items are always in view
433-
var $dropdown = $li.parent(),
434-
nDropdownHeight = $dropdown.outerHeight(),
438+
var nDropdownHeight = $dropdown.outerHeight(),
435439
nItemOffset = $li.offset().top-$dropdown.offset().top-1; // -1px for top border
436440
if ($li.index()===0) {
437441
$dropdown.scrollTop(0);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pretty-dropdowns",
3-
"version": "4.13.0",
3+
"version": "4.15.0",
44
"description": "A simple, lightweight jQuery plugin to create stylized drop-down menus.",
55
"keywords": [
66
"jquery-plugin",

0 commit comments

Comments
 (0)