mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
tap updates for select elements
This commit is contained in:
@@ -183,7 +183,8 @@ function triggerMouseEvent(type, ele, x, y) {
|
||||
|
||||
function tapClickGateKeeper(e) {
|
||||
// do not allow through any click events that were not created by ionic.tap
|
||||
if( ionic.scroll.isScrolling || !e.isIonicTap && !tapRequiresNativeClick(e.target) ) {
|
||||
if( (ionic.scroll.isScrolling && ionic.tap.containsOrIsTextInput(e.target) ) ||
|
||||
(!e.isIonicTap && !tapRequiresNativeClick(e.target)) ) {
|
||||
console.debug('clickPrevent', e.target.tagName);
|
||||
e.stopPropagation();
|
||||
|
||||
|
||||
@@ -767,7 +767,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
var mousedown = false;
|
||||
|
||||
container.addEventListener("mousedown", function(e) {
|
||||
if ( ionic.tap.ignoreScrollStart(e) ) {
|
||||
if ( ionic.tap.ignoreScrollStart(e) || e.target.tagName === 'SELECT' ) {
|
||||
return;
|
||||
}
|
||||
self.doTouchStart([{
|
||||
|
||||
@@ -4,88 +4,45 @@
|
||||
* --------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
// shared styles for transparent select elements
|
||||
.select-inline select,
|
||||
.item-select select {
|
||||
@include appearance(none);
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: #333;
|
||||
|
||||
// hack to hide default dropdown arrow in FF
|
||||
text-indent: 1px;
|
||||
text-overflow: '';
|
||||
|
||||
white-space: nowrap;
|
||||
font-size: $font-size-base;
|
||||
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.select-inline {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
border: $input-border-width solid $input-border;
|
||||
border-radius: 2px;
|
||||
background-color: $input-bg;
|
||||
color: $input-color;
|
||||
|
||||
vertical-align: middle;
|
||||
font-size: $font-size-base;
|
||||
line-height: $font-size-base + 2;
|
||||
|
||||
select {
|
||||
padding: 6px 25px 7px 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.select-inline + .select-inline {
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
.item-select {
|
||||
position: relative;
|
||||
|
||||
select {
|
||||
@include appearance(none);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: ($item-padding - 2) ($item-padding * 3) ($item-padding) 5px;
|
||||
width: 100%;
|
||||
padding: ($item-padding - 2) ($item-padding * 3) ($item-padding) $item-padding;
|
||||
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: #333;
|
||||
|
||||
// hack to hide default dropdown arrow in FF
|
||||
text-indent: .01px;
|
||||
text-overflow: '';
|
||||
|
||||
white-space: nowrap;
|
||||
font-size: $font-size-base;
|
||||
|
||||
cursor: pointer;
|
||||
direction: rtl; // right align the select text
|
||||
|
||||
&:focus {
|
||||
min-width: 30%;
|
||||
width: auto; // shrink width when opened
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// shared styles for dropdown arrow
|
||||
.select-inline:after,
|
||||
.item-select:after {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
margin-top: -3px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 5px solid;
|
||||
border-right: 5px solid rgba(0, 0, 0, 0);
|
||||
border-left: 5px solid rgba(0, 0, 0, 0);
|
||||
color: #999;
|
||||
content: "";
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.select-inline:after {
|
||||
right: 7px;
|
||||
}
|
||||
|
||||
.item-select:after {
|
||||
right: $item-padding;
|
||||
&:after {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: $item-padding;
|
||||
margin-top: -3px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 5px solid;
|
||||
border-right: 5px solid rgba(0, 0, 0, 0);
|
||||
border-left: 5px solid rgba(0, 0, 0, 0);
|
||||
color: #999;
|
||||
content: "";
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
select {
|
||||
|
||||
@@ -85,6 +85,69 @@
|
||||
Watch Count: {{ radioWatchCount }}
|
||||
</div>
|
||||
|
||||
<div class="item item-divider">
|
||||
Select
|
||||
</div>
|
||||
|
||||
<div class="item item-input item-select">
|
||||
<div class="input-label">
|
||||
Div Wrapped Select
|
||||
</div>
|
||||
<select>
|
||||
<option>Blue</option>
|
||||
<option selected="">Green</option>
|
||||
<option>Red</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="item item-input item-select">
|
||||
<div class="input-label">
|
||||
Div Wrapped Select
|
||||
</div>
|
||||
<select>
|
||||
<option>ARC-170</option>
|
||||
<option>A-wing</option>
|
||||
<option>Delta-7</option>
|
||||
<option>Naboo N-1</option>
|
||||
<option>TIE</option>
|
||||
<option selected="">X-wing</option>
|
||||
<option>Y-wing</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<label class="item item-input item-select">
|
||||
<div class="input-label">
|
||||
Label Wrapped Select
|
||||
</div>
|
||||
<select>
|
||||
<option>2-1B</option>
|
||||
<option>B1</option>
|
||||
<option>C-3PO</option>
|
||||
<option>IG-88</option>
|
||||
<option>IT-O</option>
|
||||
<option selected="">R2-D2</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label class="item item-input item-select">
|
||||
<div class="input-label">
|
||||
Label Wrapped Select
|
||||
</div>
|
||||
<select>
|
||||
<option>Alderaan</option>
|
||||
<option selected="">Dagobah</option>
|
||||
<option>Felucia</option>
|
||||
<option>Geonosis </option>
|
||||
<option>Hoth</option>
|
||||
<option>Kamino</option>
|
||||
<option>Mygeeto</option>
|
||||
<option>Naboo</option>
|
||||
<option>Tataouine</option>
|
||||
<option>Utapau</option>
|
||||
<option>Yavin</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<div class="item item-divider">
|
||||
Other Tests
|
||||
</div>
|
||||
|
||||
@@ -56,6 +56,11 @@ Physical Device Testing Scenarios
|
||||
- If you touchstart on a text input, then scrolland touchend, it should not bring up the keyboard
|
||||
- If you touchstart on a label wrapping a text input, then scroll and touchend, it should not bring up the keyboard
|
||||
- When focused in a text input, be able to get out when tapping a checkbox
|
||||
- Can scroll when the target is a select element (touch events only)
|
||||
- Can scroll when the target is a label which wraps select element
|
||||
- Can open the select options on touch when not scrolling
|
||||
- Can open the select options mouse click when target is a select
|
||||
- Can open the select options when target is a label wrapping a select
|
||||
|
||||
Tested on:
|
||||
----------------------------
|
||||
|
||||
Reference in New Issue
Block a user