Disable the text-highlighting magnifier on touch-hold on Mobile Safari / Webkit - iphone

I have some elements in my iPhone website that don't have any text in them but require the user to click and hold on them (DIVs). This causes the text-highlighting/editing loop/cursor to show up, which is really distracting.
I know there is a CSS rule for removing the black-box that shows up on clickable elements when they are touched. Is there anything like that to disable the text magnifier?

Just got a response from the Developer Center help desk. I needed to add this CSS rule:
-webkit-user-select: none;

Add this to the CSS
body {
-webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
-webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
-webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */}

Use these CSS rules:
-webkit-touch-callout: none;
-webkit-user-select: none; /* Disable selection/copy in UIWebView */

This is also useful in protecting content that you don't want copied or saved, such as an image:
#yourdiv img {-webkit-touch-callout: none; }

This solved it for me, in JS:
document.getElementsByTagName("body")[0].addEventListener("touchstart",
function(e) { e.returnValue = false });
Seems to bypass whatever the OS has in there to catch the touch.

I found this out while trying it out myself. First of all you have to add this rule to the enclosing element:
-webkit-user-select: none;
But that, by itself, is not enough on the iPhone. It turns out that the magnifying glass can still appear because, for example, a parent element would accept selection, or just because it feels like it.
However, I then discovered something cool - if your element adds a touchend and click handler to an element, then Apple's Safari finally avoids the annoying code path that causes the magnifying glass to appear, probably realizing that this element is meant for some UI interaction, and not selecting text. On an equally awesome note, if you do this on elements near the top of the screen, it will also cancel the appearance of the navigation in landscape mode! Not sure however how to cancel the appearance of navigation when clicking on elements on the bottom, does anyone have a solution for that one?

On IOS 15.2 -webkit-user-select: none; fixed the issue, but only partially.
A long press doesn't show the magnifier anymore. However, if you double-tap and hold, it magically still appears.
There is still no 100% reliable way except event.preventDefault on touchstart. But this also blocks underlying actions so things like buttons with long-press tooltips break. Therefore, it is not always an option...

Related

MailChimp template: hideable block containing repeatable blocks can't be hidden

I have a block in my MailChimp email template something like this:
Latest news
[Introductory text]
[Repeatable news item]
[Link to all news on site]
The whole block is set to be mc:hideable, and the news item uses mc:repeatable.
The problem is that when I hover over the area inside the block but outside the news item, I see the eye icon to hide the whole block - it appears in the middle, over the news item. But when I move to click it, the news item's edit / repeat control appear and the block's hideable icon disappears!
Am I missing something? The only workaround I can think of at the moment is creating 3 blocks, the heading / intro (hideable), and the news item (repeatable, presumably that can be hidden by removing the default item), and the link. They'll each need the same background colour and to fit flush together to look like one block, and in order to hide the lot editors will have to remember to hide each part. Seems a bit long-winded.
Infuriating isn't it? Which is why I hacked Chimps own CSS by adding this to my template style tag CSS:
.tpl-hidewrap { left:auto !important; right:0 !important; }
Of course you could add different CSS to position it to suit your template, but it certainly worked for me, as the area to be hidden was wider than the repeating area.
Humans 1 Chimps 0 :)
KevAdamson's answer was a good starting point for me. I had to go one step further though:
.tpl-hidewrap {
left: 0 !important;
right: 0 !important;
display: block !important;
height: 100px !important;
text-align: center;
}

Can't click or tap below the bottom half of a screen on website on iPhone 5

I've been given the task to try and fix an issue on this site:
[redacted]
When you tap below the bottom half of the screen on an iPhone 5, taps aren't registering and so links can't be clicked, etc.
I tried debugging by alerting what element is tapped, and nothing is registering below the halfway point. If you scroll down the page so the link you want to click is above the top half, it works perfectly fine.
I've searched around and there seems to be some issues with iPhone 5 apps (as far as I can tell, I'm not an app developer!) but I can't seem to find anyone having the same error on a responsive website.
What's going on - is it something to do with the viewport?
It looks like in your DOM you have an <iframe "id=FirebugUI"> that sits right below your element. It has some inline styles that include visibility:hidden; and a z-index of a super large number which means it's a hidden element that is on top of everything. You have some options:
1 - Get rid of it if you're familiar with what firebugUI is and can comfortably remove it all together. then you're good to go. It's probably being injected with some javascript.
2 - display none - you can add this css to remove it:
#FirebugUI {
display: none !important;
}
You'll need to add the important to the value so it overrides the inline styles. This may render the FirebugUI useless though.
3 - z index - you can update the z-index by setting it to like 0. But that will probably render this thing useless. so you might as well just remove this plugin if you're going to do that. You'll also need to use the !important value to override the inline styles.

How to manipulate tinyMCE image functionality

I'm trying to manipulate the functionality of tinyMCE when user tries to attach picture in the editor. What I want to achieve is to HARDCODE the properties of the picture. So when he selects a picture I want to disable the options for SIZE selection, orientation and all other options. Is this possible and what are the ways to do that... I searched the web but without any luck. My idea is to open the script file ot tinyMCE image plugin and to change the values which the script takes and inserts like inline styles, but I'll be glad to see if there is more elegant solution.
Thanks in advance,
Z.
You could add the unselectable=true attribute to the image. This way the image cannot get resized (you may strip out that attribute later on before saving the content to db). To disallow special attributes of your image you may define what attributes are allowed using the tinymce valid_elements setting.
UPDATE: This is the css necessary to be set using the tinymce param content_css in order to make images non-resizeable
img {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none; /* IE10+ */
user-select: none;
}

ExtJS 3 -- Always Show menu icon in GridPanel Column Header?

I have a requirement to always show the menu icon in a a GridPanel's column header. See attached image. I've tracked down the css class and see the <td /> tag is assigned the x-grid3-hd-btn on hover. The x-grid3-hd-btn class uses a background image, grid3-hd-btn.gif to display the drop-down arrow I want, but I'm not css savvy enough to figure out how to always show it.
There doesn't seem to be a hook in the GridPanel class api's to always display this, wish there was. Also, note that I only want the arrow icon to show, I don't want the column header to change color, etc.
Does anyone have any guidance on this?
Thanks!
John
Add this to your stylesheet, this overwrites default extjs theme styles
/**
* EXTJS Grid-3 Always visible header buttons
*/
.x-grid3-hd-btn {
display: block !important;
height: 22px !important;
}
.x-grid3-hd {
cursor: pointer;
}
have you tried replacing the css class background image in your ext-all.css file?
original:
.x-grid3-header{
background-color:#f9f9f9;
background-image:url(../images/default/grid/grid3-hrow.gif);
}
replace to :
.x-grid3-header{
background-color:#f9f9f9;
background-image:url(../images/default/grid/grid3-hrow-over.gif);
}
tell me if that did it...

GWT push button blue border behaviour

Does anybody can tell me where that blue border that appears after you push a PushButton comes from?
I really want to override that behaviour, don't know where or how though
UPDATE:
the effect I'm talking about turns out to be blue on Safari, it goes orange on Chrome and no effect on Mozilla
it occurs when the button has been pressed once, best way to explain it is the http://gwt.google.com/samples/Showcase/Showcase.html#!CwCustomButton
Are you talking about the "focus ring" that appear around any element when it's focused?
You can tweak it using the outline set of CSS properties: http://www.w3.org/TR/CSS21/ui.html#dynamic-outlines
But please note that it's bad practice (re. accessibility) to completely remove it, as you'd remove any indication of whether the button is focused or not, and incidentally, which element is focused, if any.
This behavior should be defined in the appropriate stylesheet. If you check GWT sources that would be in /trunk/user/src/com/google/gwt/user/theme/standard/public/gwt/standard/standard.css. It's also defined in other themes.
What you should do is define your own styles
.my-PushButton
{
border : 1px solid #666;
padding : 0 10px;
}
.my-PushButton-down-hovering
{
background-color : #aaf;
}
.my-PushButton-up-hovering
{
background-color : #afa;
}
And then
PushButton btn = new PushButton(...);
widget.setStylePrimaryName("my-PushButton");
Hope this helps.