Search and Top Navigation
Ticket #5233: patch-mar-1.txt
File patch-mar-1.txt, 5.3 KB (added by Gijs, March 01, 2010 07:27PM UTC)
Updated version of the patch
Index: themes/base/jquery.ui.core.css
===================================================================
--- themes/base/jquery.ui.core.css (revision 3860)
+++ themes/base/jquery.ui.core.css (working copy)
@@ -30,8 +30,33 @@
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+/* High contrast compatibility
++----------------------------------*/
+.high-contrast .ui-icon,
+.high-contrast .ui-dialog .ui-dialog-titlebar-close,
+.high-contrast .ui-datepicker .ui-datepicker-next,
+.high-contrast .ui-datepicker .ui-datepicker-prev
+{ width: auto; text-indent: 0; }
+
+/* Focus highlight for tabs */
+.high-contrast .ui-tabs.ui-widget-content .ui-state-focus { border-width: 3px; }
+
+/* Focus highlight for accordion (also out of high contrast, maybe that needs to go somewhere else? */
+.ui-accordion-header.ui-state-focus { border-width: 2px; }
+.high-contrast .ui-accordion-header.ui-state-focus { border-width: 4px; }
+
+/* Fancy positioning for datepicker buttons: */
+.high-contrast .ui-datepicker .ui-datepicker-next span { position: static; margin: 3px; }
+.high-contrast .ui-datepicker .ui-datepicker-prev span { position: static; margin: 3px; }
+
+/* Value for progress bar */
+
+.ui-progressbar-valuetext { display: none; }
+.high-contrast .ui-progressbar-valuetext { display: block; position: relative; margin: 0; margin-top: 3px; top: -100%; width: 100%; text-align: center; }
+
Index: ui/jquery.ui.core.js
===================================================================
--- ui/jquery.ui.core.js (revision 3860)
+++ ui/jquery.ui.core.js (working copy)
@@ -197,9 +197,39 @@ $.extend($.expr[':'], {
},
tabbable: function(element) {
var tabIndex = $.attr(element, 'tabindex');
return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
}
});
+// Initialize high-contrast mode check when we have document.body
+$(function() {
+ // create div for testing if high contrast mode is on or images are turned off
+ var div = document.createElement("div");
+ // The ui-icon class will give it a background image.
+ // Proper caching should mean no additional requests will be made.
+ div.className = "ui-icon";
+ div.style.borderWidth = "1px";
+ div.style.borderStyle = "solid";
+ div.style.borderTopColor = "red";
+ div.style.borderRightColor = "green";
+ div.style.position = "absolute";
+ div.style.top = "-999px";
+ document.body.appendChild(div);
+
+ // test it
+ var bkImg = $.curCSS(div, "backgroundImage");
+ $.highContrast = ($.curCSS(div, "borderTopColor") == $.curCSS(div, "borderRightColor")) ||
+ (bkImg != null && (bkImg == "none" || bkImg == "url(invalid-url:)"));
+ if ($.browser.msie) {
+ div.outerHTML = ""; // prevent mixed-content warning, see http://support.microsoft.com/kb/925014
+ } else {
+ document.body.removeChild(div);
+ }
+ if ($.highContrast) {
+ $("body").addClass("high-contrast");
+ }
+});
+
+
})(jQuery);
Index: ui/jquery.ui.progressbar.js
===================================================================
--- ui/jquery.ui.progressbar.js (revision 3860)
+++ ui/jquery.ui.progressbar.js (working copy)
@@ -24,16 +24,19 @@ $.widget( "ui.progressbar", {
role: "progressbar",
"aria-valuemin": this._valueMin(),
"aria-valuemax": this._valueMax(),
"aria-valuenow": this._value()
});
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
.appendTo( this.element );
+
+ this.valueTextDiv = $( "<div class='ui-progressbar-valuetext'>" + this._value() + "</div>")
+ .appendTo( this.element );
this._refreshValue();
},
destroy: function() {
this.element
.removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.removeAttr( "role" )
@@ -91,16 +94,17 @@ $.widget( "ui.progressbar", {
return 100;
},
_refreshValue: function() {
var value = this.value();
this.valueDiv
[ value === this._valueMax() ? "addClass" : "removeClass"]( "ui-corner-right" )
.width( value + "%" );
+ this.valueTextDiv.text(value + "%");
this.element.attr( "aria-valuenow", value );
}
});
$.extend( $.ui.progressbar, {
version: "@VERSION"
});
Index: ui/jquery.ui.button.js
===================================================================
--- ui/jquery.ui.button.js (revision 3860)
+++ ui/jquery.ui.button.js (working copy)
@@ -205,17 +205,17 @@ $.widget( "ui.button", {
buttonText = $( "<span></span>" )
.addClass( "ui-button-text" )
.html( this.options.label )
.appendTo( buttonElement.empty() )
.text();
var icons = this.options.icons,
multipleIcons = icons.primary && icons.secondary;
- if ( icons.primary || icons.secondary ) {
+ if ( !$.highContrast && ( icons.primary || icons.secondary ) ) {
buttonElement.addClass( "ui-button-text-icon" +
( multipleIcons ? "s" : "" ) );
if ( icons.primary ) {
buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
}
if ( icons.secondary ) {
buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
}
Download in other formats:
Original Format
File patch-mar-1.txt, 5.3 KB (added by Gijs, March 01, 2010 07:27PM UTC)
Updated version of the patch
Index: themes/base/jquery.ui.core.css
===================================================================
--- themes/base/jquery.ui.core.css (revision 3860)
+++ themes/base/jquery.ui.core.css (working copy)
@@ -30,8 +30,33 @@
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+/* High contrast compatibility
++----------------------------------*/
+.high-contrast .ui-icon,
+.high-contrast .ui-dialog .ui-dialog-titlebar-close,
+.high-contrast .ui-datepicker .ui-datepicker-next,
+.high-contrast .ui-datepicker .ui-datepicker-prev
+{ width: auto; text-indent: 0; }
+
+/* Focus highlight for tabs */
+.high-contrast .ui-tabs.ui-widget-content .ui-state-focus { border-width: 3px; }
+
+/* Focus highlight for accordion (also out of high contrast, maybe that needs to go somewhere else? */
+.ui-accordion-header.ui-state-focus { border-width: 2px; }
+.high-contrast .ui-accordion-header.ui-state-focus { border-width: 4px; }
+
+/* Fancy positioning for datepicker buttons: */
+.high-contrast .ui-datepicker .ui-datepicker-next span { position: static; margin: 3px; }
+.high-contrast .ui-datepicker .ui-datepicker-prev span { position: static; margin: 3px; }
+
+/* Value for progress bar */
+
+.ui-progressbar-valuetext { display: none; }
+.high-contrast .ui-progressbar-valuetext { display: block; position: relative; margin: 0; margin-top: 3px; top: -100%; width: 100%; text-align: center; }
+
Index: ui/jquery.ui.core.js
===================================================================
--- ui/jquery.ui.core.js (revision 3860)
+++ ui/jquery.ui.core.js (working copy)
@@ -197,9 +197,39 @@ $.extend($.expr[':'], {
},
tabbable: function(element) {
var tabIndex = $.attr(element, 'tabindex');
return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
}
});
+// Initialize high-contrast mode check when we have document.body
+$(function() {
+ // create div for testing if high contrast mode is on or images are turned off
+ var div = document.createElement("div");
+ // The ui-icon class will give it a background image.
+ // Proper caching should mean no additional requests will be made.
+ div.className = "ui-icon";
+ div.style.borderWidth = "1px";
+ div.style.borderStyle = "solid";
+ div.style.borderTopColor = "red";
+ div.style.borderRightColor = "green";
+ div.style.position = "absolute";
+ div.style.top = "-999px";
+ document.body.appendChild(div);
+
+ // test it
+ var bkImg = $.curCSS(div, "backgroundImage");
+ $.highContrast = ($.curCSS(div, "borderTopColor") == $.curCSS(div, "borderRightColor")) ||
+ (bkImg != null && (bkImg == "none" || bkImg == "url(invalid-url:)"));
+ if ($.browser.msie) {
+ div.outerHTML = ""; // prevent mixed-content warning, see http://support.microsoft.com/kb/925014
+ } else {
+ document.body.removeChild(div);
+ }
+ if ($.highContrast) {
+ $("body").addClass("high-contrast");
+ }
+});
+
+
})(jQuery);
Index: ui/jquery.ui.progressbar.js
===================================================================
--- ui/jquery.ui.progressbar.js (revision 3860)
+++ ui/jquery.ui.progressbar.js (working copy)
@@ -24,16 +24,19 @@ $.widget( "ui.progressbar", {
role: "progressbar",
"aria-valuemin": this._valueMin(),
"aria-valuemax": this._valueMax(),
"aria-valuenow": this._value()
});
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
.appendTo( this.element );
+
+ this.valueTextDiv = $( "<div class='ui-progressbar-valuetext'>" + this._value() + "</div>")
+ .appendTo( this.element );
this._refreshValue();
},
destroy: function() {
this.element
.removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.removeAttr( "role" )
@@ -91,16 +94,17 @@ $.widget( "ui.progressbar", {
return 100;
},
_refreshValue: function() {
var value = this.value();
this.valueDiv
[ value === this._valueMax() ? "addClass" : "removeClass"]( "ui-corner-right" )
.width( value + "%" );
+ this.valueTextDiv.text(value + "%");
this.element.attr( "aria-valuenow", value );
}
});
$.extend( $.ui.progressbar, {
version: "@VERSION"
});
Index: ui/jquery.ui.button.js
===================================================================
--- ui/jquery.ui.button.js (revision 3860)
+++ ui/jquery.ui.button.js (working copy)
@@ -205,17 +205,17 @@ $.widget( "ui.button", {
buttonText = $( "<span></span>" )
.addClass( "ui-button-text" )
.html( this.options.label )
.appendTo( buttonElement.empty() )
.text();
var icons = this.options.icons,
multipleIcons = icons.primary && icons.secondary;
- if ( icons.primary || icons.secondary ) {
+ if ( !$.highContrast && ( icons.primary || icons.secondary ) ) {
buttonElement.addClass( "ui-button-text-icon" +
( multipleIcons ? "s" : "" ) );
if ( icons.primary ) {
buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
}
if ( icons.secondary ) {
buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
}