aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2020-01-17 10:33:11 +0000
committerDave Arter <davea@mysociety.org>2020-01-31 11:11:41 +0000
commit6525931fb9194e90a4430660086a5e981567fb7f (patch)
treec9174b333911fb993cf91fb231f17257b7e3357a
parent363cbb0ea0acf35a5bf56fcef6b3d60acc4f5fe7 (diff)
Don’t highlight duplicate pins on mobile
The presence of the ‘mouseenter’ handler meant two taps were required to expand the report preview.
-rw-r--r--web/js/duplicates.js24
1 files changed, 15 insertions, 9 deletions
diff --git a/web/js/duplicates.js b/web/js/duplicates.js
index 22f800694..4f1574c0f 100644
--- a/web/js/duplicates.js
+++ b/web/js/duplicates.js
@@ -93,15 +93,21 @@
$('.js-hide-if-invalid-category_extras').slideUp();
}
- // Highlight map pin when hovering associated list item.
- var timeout;
- $reports.on('mouseenter', function(){
- var id = parseInt( $(this).data('reportId'), 10 );
- clearTimeout( timeout );
- fixmystreet.maps.markers_highlight( id );
- }).on('mouseleave', function(){
- timeout = setTimeout( fixmystreet.maps.markers_highlight, 50 );
- });
+ if (!fixmystreet.map.events.extensions.buttonclick.isDeviceTouchCapable) {
+ // Highlight map pin when hovering associated list item.
+ // (not on touchscreens though because a) the 'mouseenter' handler means
+ // two taps are required on the 'read more' button - one to highlight
+ // the list item and another to activate the button- and b) the pins
+ // might be scrolled off the top of the screen anyway e.g. on phones)
+ var timeout;
+ $reports.on('mouseenter', function(){
+ var id = parseInt( $(this).data('reportId'), 10 );
+ clearTimeout( timeout );
+ fixmystreet.maps.markers_highlight( id );
+ }).on('mouseleave', function(){
+ timeout = setTimeout( fixmystreet.maps.markers_highlight, 50 );
+ });
+ }
// Add a "select this report" button, when on the report inspect form.
if ( $('#report_inspect_form').length ) {