Ticket #21283: 21283.diff

File 21283.diff, 4.5 KB (added by lessbloat, 8 months ago)
Line 
1Index: wp-includes/class-wp-customize-section.php
2===================================================================
3--- wp-includes/class-wp-customize-section.php  (revision 21762)
4+++ wp-includes/class-wp-customize-section.php  (working copy)
5@@ -80,7 +80,7 @@
6        protected function render() {
7                ?>
8                <li id="customize-section-<?php echo esc_attr( $this->id ); ?>" class="control-section customize-section">
9-                       <h3 class="customize-section-title" title="<?php echo esc_attr( $this->description ); ?>"><?php echo esc_html( $this->title ); ?></h3>
10+                       <h3 class="customize-section-title" tabindex="0" title="<?php echo esc_attr( $this->description ); ?>"><?php echo esc_html( $this->title ); ?></h3>
11                        <ul class="customize-section-content">
12                                <?php
13                                foreach ( $this->controls as $control )
14Index: wp-admin/customize.php
15===================================================================
16--- wp-admin/customize.php      (revision 21762)
17+++ wp-admin/customize.php      (working copy)
18@@ -83,9 +83,9 @@
19                        $cannot_expand = ! ( $screenshot || $wp_customize->theme()->get('Description') );
20                ?>
21 
22-               <div class="wp-full-overlay-sidebar-content">
23+               <div class="wp-full-overlay-sidebar-content" tabindex="-1">
24                        <div id="customize-info" class="customize-section<?php if ( $cannot_expand ) echo ' cannot-expand'; ?>">
25-                               <div class="customize-section-title">
26+                               <div class="customize-section-title" tabindex="0">
27                                        <span class="preview-notice"><?php
28                                                /* translators: %s is the theme name in the Customize/Live Preview pane */
29                                                echo sprintf( __( 'You are previewing %s' ), '<strong class="theme-name">' . $wp_customize->theme()->display('Name') . '</strong>' );
30Index: wp-admin/js/customize-controls.js
31===================================================================
32--- wp-admin/js/customize-controls.js   (revision 21762)
33+++ wp-admin/js/customize-controls.js   (working copy)
34@@ -824,11 +824,22 @@
35                }());
36 
37                // Temporary accordion code.
38-               $('.customize-section-title').click( function( event ) {
39+               var accordianFrozen = false;
40+               $('.customize-section-title').bind('click focus', function( event ) {
41                        var clicked = $( this ).parents( '.customize-section' );
42 
43-                       if ( clicked.hasClass('cannot-expand') )
44+                       if ( clicked.hasClass('cannot-expand') || accordianFrozen )
45                                return;
46+                       
47+                       // Don't want to fire focus and click at same time
48+                       accordianFrozen = true;
49+                       setTimeout(function () {
50+                               accordianFrozen = false;
51+                       }, 400);
52+                       
53+                       // Scroll up if on #customize-section-title_tagline
54+                       if ('customize-section-title_tagline' === clicked.attr('id'))
55+                               $('.wp-full-overlay-sidebar-content').scrollTop(0);
56 
57                        $( '.customize-section' ).not( clicked ).removeClass( 'open' );
58                        clicked.toggleClass( 'open' );
59@@ -839,7 +850,20 @@
60                $('#save').click( function( event ) {
61                        previewer.save();
62                        event.preventDefault();
63+               }).keydown( function( event ) {
64+                       if ( 13 === event.which ) // enter
65+                               previewer.save();
66+                       event.preventDefault();
67                });
68+               
69+               $('.back').keydown( function( event ) {
70+                       if ( 9 === event.which ) // tab
71+                               return;
72+                       var thisHref = $(this).attr('href');
73+                       if ( 13 === event.which ) // enter
74+                               window.location = thisHref;
75+                       event.preventDefault();
76+               });
77 
78                $('.collapse-sidebar').click( function( event ) {
79                        overlay.toggleClass( 'collapsed' ).toggleClass( 'expanded' );
80@@ -958,6 +982,13 @@
81                });
82 
83                api.trigger( 'ready' );
84+               
85+               // Make sure left column gets focus
86+               $('.back').focus();
87+               setTimeout(function () {
88+                       $('.back').focus();
89+               }, 800);
90+
91        });
92 
93 })( wp, jQuery );
94\ No newline at end of file
95Index: wp-admin/css/customize-controls.css
96===================================================================
97--- wp-admin/css/customize-controls.css (revision 21762)
98+++ wp-admin/css/customize-controls.css (working copy)
99@@ -67,7 +67,8 @@
100 
101 .control-section:hover .customize-section-title,
102 .control-section .customize-section-title:hover,
103-.control-section.open .customize-section-title {
104+.control-section.open .customize-section-title,
105+.customize-section-title:focus {
106        color: #fff;
107        text-shadow: 0 -1px 0 #333;
108        background: #808080;
109@@ -126,6 +127,11 @@
110        color: #999;
111 }
112 
113+#customize-info .customize-section-title:focus .preview-notice {
114+       color: #ccc;
115+       text-shadow: 0 -1px 0 #333;
116+}
117+
118 #customize-info .theme-name {
119        font-size: 20px;
120        font-weight: 200;
121@@ -135,6 +141,11 @@
122        text-shadow: 0 1px 0 #fff;
123 }
124 
125+#customize-info .customize-section-title:focus .theme-name {
126+       color: #fff;
127+       text-shadow: 0 -1px 0 #333;
128+}
129+
130 #customize-info .theme-screenshot {
131        width: 258px;
132        border: 1px solid #ccc;