Ticket #22502: 22502.7.diff
File 22502.7.diff, 6.7 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 } … … 506 507 0 0 0 5px #1e8cbe; 507 508 } 508 509 510 .attachment:focus { 511 outline: 1px solid #999; 512 outline-offset: 1px; 513 } 514 515 .attachment:active { 516 outline: none; 517 } 518 519 .selected.attachment:focus { 520 outline-offset: 3px; 521 } 522 523 .details.attachment:focus { 524 outline: 1px solid #333; 525 outline-offset: 4px; 526 } 527 509 528 .attachment-preview { 510 529 position: relative; 511 530 width: 199px; … … 683 702 background-position: -60px 0; 684 703 } 685 704 686 .media-frame .describe {705 .media-frame input.describe { 687 706 position: relative; 688 707 display: block; 689 708 width: 100%; … … 1070 1089 0 0 0 3px #1e8cbe; 1071 1090 } 1072 1091 1092 .attachment.selection:focus { 1093 outline: 1px solid #999; 1094 outline-offset: 1px; 1095 } 1096 1097 .attachment.selection.details:focus { 1098 outline: 1px solid #333; 1099 outline-offset: 3px; 1100 } 1101 1073 1102 .media-selection:after { 1074 1103 content: ''; 1075 1104 display: block; … … 1359 1388 width: 119px; 1360 1389 } 1361 1390 1362 .media-menu li{1391 .media-menu .media-menu-item { 1363 1392 padding: 4px 10px; 1364 1393 } 1365 1394 -
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 ) … … 2422 2481 className: 'attachment', 2423 2482 template: media.template('attachment'), 2424 2483 2484 attributes: { 2485 tabindex: 0 2486 }, 2487 2425 2488 events: { 2426 2489 'click .attachment-preview': 'toggleSelection', 2490 'keydown': 'keydown', 2427 2491 'change [data-setting]': 'updateSetting', 2428 2492 'change [data-setting] input': 'updateSetting', 2429 2493 'change [data-setting] select': 'updateSetting', … … 2500 2564 this.$bar.width( this.model.get('percent') + '%' ); 2501 2565 }, 2502 2566 2503 toggleSelection: function( event ) { 2567 keydown: function( event ) { 2568 if ( $.ui.keyCode.ENTER === event.keyCode ) 2569 this.toggleSelection(); 2570 }, 2571 2572 toggleSelection: function() { 2504 2573 var selection = this.options.selection, 2505 2574 model = this.model; 2506 2575 -
wp-includes/media.php
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 ) { #>