Use a standard title attribute for the control buttons

This commit is contained in:
Frederic Junod
2014-10-01 17:25:06 +02:00
parent abb86e16f0
commit 9ebde652dc
7 changed files with 22 additions and 107 deletions

View File

@@ -131,65 +131,6 @@ button.ol-full-screen-true:after {
content: "\00d7";
}
/* invisible but not hidden */
.ol-has-tooltip [role=tooltip] {
position: absolute;
clip: rect(1px 1px 1px 1px); /* < IE8 */
clip: rect(1px, 1px, 1px, 1px);
padding: 0;
border: 0;
height: 1px;
width: 1px;
overflow: hidden;
font-weight: normal;
font-size: 14px;
text-shadow: 0 0 2px #fff;
}
/* show a tooltip offset to below and right */
.ol-has-tooltip:hover [role=tooltip], .ol-has-tooltip:focus [role=tooltip] {
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
clip: auto;
padding: 0 .4em;
font-size: .8em;
height: 1.2em;
width: auto;
line-height: 1.2em;
z-index: 1100;
max-height: 100px;
white-space: nowrap;
display: inline-block;
background: #FFF;
background: rgba(255,255,255,0.6);
color: #000;
border: 3px solid rgba(255,255,255,0);
border-left-width: 0;
border-radius: 0 4px 4px 0;
bottom: .3em;
left: 2.2em;
}
.ol-touch .ol-has-tooltip:hover [role=tooltip],
.ol-touch .ol-has-tooltip:focus [role=tooltip] {
display: none;
}
.ol-zoom .ol-has-tooltip:hover [role=tooltip],
.ol-zoom .ol-has-tooltip:focus [role=tooltip] {
top: 1.1em;
}
.ol-rotate .ol-has-tooltip:hover [role=tooltip],
.ol-rotate .ol-has-tooltip:focus [role=tooltip],
.ol-attribution .ol-has-tooltip:hover [role=tooltip],
.ol-attribution .ol-has-tooltip:focus [role=tooltip],
.ol-full-screen .ol-has-tooltip:hover [role=tooltip],
.ol-full-screen .ol-has-tooltip:focus [role=tooltip] {
right: 2.2em;
left: auto;
border-radius: 4px 0 0 4px;
border-left-width: 3px;
border-right-width: 0;
}
.ol-attribution {
text-align: right;
@@ -222,7 +163,6 @@ button.ol-full-screen-true:after {
.ol-attribution ul, .ol-attribution button {
display: inline-block;
}
.ol-attribution:not(.ol-collapsed) button:hover [role=tooltip],
.ol-attribution.ol-collapsed ul {
display: none;
}
@@ -284,8 +224,7 @@ button.ol-full-screen-true:after {
.ol-control button,
.ol-attribution,
.ol-scale-line-inner,
.ol-has-tooltip [role=tooltip] {
.ol-scale-line-inner {
font-family: 'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;
}
@@ -314,7 +253,6 @@ button.ol-full-screen-true:after {
left: 2px;
position: absolute;
}
.ol-overviewmap:not(.ol-collapsed) button:hover [role=tooltip],
.ol-overviewmap.ol-collapsed .ol-overviewmap-map,
.ol-overviewmap.ol-uncollapsible button {
display: none;

View File

@@ -69,9 +69,6 @@ ol.control.Attribution = function(opt_options) {
var tipLabel = goog.isDef(options.tipLabel) ?
options.tipLabel : 'Attributions';
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, tipLabel);
/**
* @private
@@ -96,10 +93,9 @@ ol.control.Attribution = function(opt_options) {
*/
this.labelSpan_ = label;
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': 'ol-has-tooltip',
'type': 'button'
'type': 'button',
'title': tipLabel
}, this.labelSpan_);
goog.dom.appendChild(button, tip);
var buttonHandler = new ol.pointer.PointerEventHandler(button);
this.registerDisposable(buttonHandler);

View File

@@ -40,16 +40,11 @@ ol.control.FullScreen = function(opt_options) {
var tipLabel = goog.isDef(options.tipLabel) ?
options.tipLabel : 'Toggle full-screen';
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, tipLabel);
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': this.cssClassName_ + '-' + goog.dom.fullscreen.isFullScreen() +
' ol-has-tooltip',
'type': 'button'
'class': this.cssClassName_ + '-' + goog.dom.fullscreen.isFullScreen(),
'type': 'button',
'title': tipLabel
});
goog.dom.appendChild(button, tip);
var buttonHandler = new ol.pointer.PointerEventHandler(button);
this.registerDisposable(buttonHandler);
goog.events.listen(buttonHandler,

View File

@@ -57,9 +57,6 @@ ol.control.OverviewMap = function(opt_options) {
var tipLabel = goog.isDef(options.tipLabel) ?
options.tipLabel : 'Overview map';
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, tipLabel);
/**
* @private
@@ -83,10 +80,9 @@ ol.control.OverviewMap = function(opt_options) {
*/
this.labelSpan_ = label;
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': 'ol-has-tooltip',
'type': 'button'
'type': 'button',
'title': tipLabel
}, this.labelSpan_);
goog.dom.appendChild(button, tip);
var buttonHandler = new ol.pointer.PointerEventHandler(button);
this.registerDisposable(buttonHandler);

View File

@@ -44,13 +44,11 @@ ol.control.Rotate = function(opt_options) {
var tipLabel = goog.isDef(options.tipLabel) ?
options.tipLabel : 'Reset rotation';
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, tipLabel);
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': className + '-reset ol-has-tooltip',
'type' : 'button'
}, tip, this.label_);
'class': className + '-reset',
'type' : 'button',
'title': tipLabel
}, this.label_);
var handler = new ol.pointer.PointerEventHandler(button);
this.registerDisposable(handler);

View File

@@ -41,13 +41,11 @@ ol.control.Zoom = function(opt_options) {
var zoomOutTipLabel = goog.isDef(options.zoomOutTipLabel) ?
options.zoomOutTipLabel : 'Zoom out';
var tTipZoomIn = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, zoomInTipLabel);
var inElement = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': className + '-in ol-has-tooltip',
'type' : 'button'
}, tTipZoomIn, zoomInLabel);
'class': className + '-in',
'type' : 'button',
'title': zoomInTipLabel
}, zoomInLabel);
var inElementHandler = new ol.pointer.PointerEventHandler(inElement);
this.registerDisposable(inElementHandler);
@@ -65,13 +63,11 @@ ol.control.Zoom = function(opt_options) {
this.blur();
}, false);
var tTipsZoomOut = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, zoomOutTipLabel);
var outElement = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': className + '-out ol-has-tooltip',
'type' : 'button'
}, tTipsZoomOut, zoomOutLabel);
'class': className + '-out',
'type' : 'button',
'title': zoomOutTipLabel
}, zoomOutLabel);
var outElementHandler = new ol.pointer.PointerEventHandler(outElement);
this.registerDisposable(outElementHandler);

View File

@@ -35,14 +35,10 @@ ol.control.ZoomToExtent = function(opt_options) {
var tipLabel = goog.isDef(options.tipLabel) ?
options.tipLabel : 'Fit to extent';
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, tipLabel);
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': 'ol-has-tooltip',
'type': 'button'
'type': 'button',
'title': tipLabel
});
goog.dom.appendChild(button, tip);
var buttonHandler = new ol.pointer.PointerEventHandler(button);
this.registerDisposable(buttonHandler);