Ticket #22502: 22502.5.diff
File 22502.5.diff, 6.3 KB (added by , 12 years ago) |
---|
-
wp-includes/css/media-views.css
366 366 user-select: none; 367 367 } 368 368 369 .media-menu li { 369 .media-menu .media-menu-item { 370 display: block; 370 371 position: relative; 371 372 padding: 4px 20px; 372 373 margin: 0; 373 374 line-height: 18px; 374 375 font-size: 14px; 375 color: #21759B;376 376 text-shadow: 0 1px 0 #fff; 377 text-decoration: none; 377 378 } 378 379 379 .media-menu-item { 380 cursor: pointer; 381 } 382 383 .media-menu li:hover { 380 .media-menu .media-menu-item:hover, 381 .media-menu .media-menu-item:focus { 382 color: #21759B; 383 background: #f1f1f1; 384 384 background: rgba( 0, 0, 0, 0.04 ); 385 outline: none; 385 386 } 386 387 387 .media-menu . active,388 .media-menu . active:hover {388 .media-menu .media-menu-item.active, 389 .media-menu .media-menu-item.active:hover { 389 390 color: #333; 390 391 font-weight: bold; 391 392 } … … 517 518 cursor: pointer; 518 519 } 519 520 521 .attachment-preview:focus { 522 outline: thin dotted; 523 } 524 520 525 .attachment .icon { 521 526 margin: 0 auto; 522 527 overflow: hidden; … … 1359 1364 width: 119px; 1360 1365 } 1361 1366 1362 .media-menu li{1367 .media-menu .media-menu-item { 1363 1368 padding: 4px 10px; 1364 1369 } 1365 1370 -
wp-includes/js/media-editor.js
548 548 workflow.open(); 549 549 else 550 550 workflow = wp.media.editor.add( id ); 551 551 552 // Add focus to modal 553 $( '.media-menu .active' ).focus(); 554 552 555 return workflow; 553 556 } 554 557 }; -
wp-includes/js/media-views.js
1647 1647 tagName: 'div', 1648 1648 template: media.template('media-modal'), 1649 1649 1650 attributes: { 1651 tabindex: 0 1652 }, 1653 1650 1654 events: { 1651 'click .media-modal-backdrop, .media-modal-close' : 'closeHandler' 1655 'click .media-modal-backdrop, .media-modal-close': 'closeHandler', 1656 'keydown': 'keydown' 1652 1657 }, 1653 1658 1654 1659 initialize: function() { … … 1659 1664 title: '', 1660 1665 propagate: true 1661 1666 }); 1667 1668 _.bindAll( this, '_captureBodyKeydown' ); 1662 1669 }, 1663 1670 1664 1671 render: function() { … … 1689 1696 }, 1690 1697 1691 1698 open: function() { 1699 document.addEventListener( 'keydown', this._captureBodyKeydown, true ); 1692 1700 this.$el.show(); 1693 1701 return this.propagate('open'); 1694 1702 }, 1695 1703 1696 1704 close: function() { 1705 document.removeEventListener( 'keydown', this._captureBodyKeydown, true ); 1697 1706 this.$el.hide(); 1698 1707 return this.propagate('close'); 1699 1708 }, … … 1722 1731 this.controller.trigger( id ); 1723 1732 1724 1733 return this; 1734 }, 1735 1736 // Thanks to jQuery UI dialog, which also limits tabbing to a modal 1737 // window. The `:tabbable` expression, `$.ui.keyCode` object, and 1738 // the overloaded `$.fn.focus( delay )` signature are all from the 1739 // jQuery UI core. 1740 keydown: function( event ) { 1741 var tabbables, first, last; 1742 1743 // Close the modal when escape is pressed. 1744 if ( $.ui.keyCode.ESCAPE === event.which ) { 1745 event.preventDefault(); 1746 this.close(); 1747 return; 1748 } 1749 1750 // Prevent tabbing outside of the modal. 1751 if ( event.keyCode !== $.ui.keyCode.TAB ) 1752 return; 1753 1754 tabbables = this.$(':tabbable'); 1755 first = tabbables.filter(':first'); 1756 last = tabbables.filter(':last'); 1757 1758 // If we attempt to tab past the last tabbable element, skip 1759 // straight to the first tabbable element (and vice versa). 1760 if ( event.target === last[0] && ! event.shiftKey ) { 1761 first.focus( 1 ); 1762 return false; 1763 } else if ( event.target === first[0] && event.shiftKey ) { 1764 last.focus( 1 ); 1765 return false; 1766 } 1767 }, 1768 1769 // If the focus somehow escapes the modal, restores focus to the 1770 // first focusable element inside the modal. 1771 // 1772 // Captures the document's keydown event when the modal is open. 1773 _captureBodyKeydown: function() { 1774 if ( event.keyCode !== $.ui.keyCode.TAB ) 1775 return; 1776 1777 if ( ! $.contains( this.el, document.activeElement ) ) 1778 this.$(':tabbable').first().focus( 1 ); 1725 1779 } 1726 1780 }); 1727 1781 … … 2354 2408 * wp.media.view.Menu 2355 2409 */ 2356 2410 media.view.Menu = media.view.PriorityList.extend({ 2357 tagName: 'ul',2358 2411 className: 'media-menu', 2359 2412 2360 2413 toView: function( options, state ) { … … 2379 2432 }); 2380 2433 2381 2434 media.view.MenuItem = media.View.extend({ 2382 tagName: ' li',2435 tagName: 'a', 2383 2436 className: 'media-menu-item', 2384 2437 2438 attributes: { 2439 href: '#' 2440 }, 2441 2385 2442 events: { 2386 2443 'click': 'click' 2387 2444 }, 2388 2445 2389 click: function( ) {2446 click: function( event ) { 2390 2447 var options = this.options; 2391 2448 2449 event.preventDefault(); 2450 2392 2451 if ( options.click ) 2393 2452 options.click.call( this ); 2394 2453 else if ( options.state ) … … 2424 2483 2425 2484 events: { 2426 2485 'click .attachment-preview': 'toggleSelection', 2486 'keydown .attachment-preview': 'keydown', 2427 2487 'change [data-setting]': 'updateSetting', 2428 2488 'change [data-setting] input': 'updateSetting', 2429 2489 'change [data-setting] select': 'updateSetting', … … 2500 2560 this.$bar.width( this.model.get('percent') + '%' ); 2501 2561 }, 2502 2562 2503 toggleSelection: function( event ) { 2563 keydown: function( event ) { 2564 if ( $.ui.keyCode.ENTER === event.keyCode ) 2565 this.toggleSelection(); 2566 }, 2567 2568 toggleSelection: function() { 2504 2569 var selection = this.options.selection, 2505 2570 model = this.model; 2506 2571 -
wp-includes/media.php
1603 1603 </script> 1604 1604 1605 1605 <script type="text/html" id="tmpl-attachment"> 1606 <div class="attachment-preview type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}" >1606 <div class="attachment-preview type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}" tabindex="0"> 1607 1607 <# if ( data.uploading ) { #> 1608 1608 <div class="media-progress-bar"><div></div></div> 1609 1609 <# } else if ( 'image' === data.type ) { #> … … 1624 1624 <# } #> 1625 1625 1626 1626 <# if ( data.buttons.check ) { #> 1627 <a class="check" href="#" title="<?php _e('Deselect'); ?>" ><div class="media-modal-icon"></div></a>1627 <a class="check" href="#" title="<?php _e('Deselect'); ?>" tabindex="-1"><div class="media-modal-icon"></div></a> 1628 1628 <# } #> 1629 1629 </div> 1630 1630 <# if ( data.describe ) { #>