-
Notifications
You must be signed in to change notification settings - Fork 767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReCaptcha is not really responsive. #61
Comments
It's too bad it isn't responsive indeed. The only decent workaround I have found so far is scaling the whole thing down a bit with css transform. |
You can also try specifying the |
The image select box is now broken with an annoying text area 😞, hoping someone can submit a fix. |
@huynhquancam do you have a screenshot or a way to reproduce? |
@rowan-m thanks, here is the screenshot from my localhost and also the HTML generated <div class="form-group">
<script src="//www.google.com/recaptcha/api.js" async="" defer=""></script>
<div class="g-recaptcha" data-sitekey="XXX">
<div>
<div style="width: 302px; height: 422px; position: relative;">
<div style="width: 302px; height: 422px; position: absolute;">
<iframe src="https://www.google.com/recaptcha/api/fallback?k=XXX&hl=en&v=r20150812220525&t=1&ff=true" frameborder="0" scrolling="no" style="width: 302px; height:422px; border-style: none;"></iframe>
</div>
</div>
<div style="border-style: none; bottom: 12px; left: 25px; margin: 0px; padding: 0px; right: 25px; background: #f9f9f9; border: 1px solid #c1c1c1; border-radius: 3px; height: 60px; width: 300px;">
<textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 40px; border: 1px solid #c1c1c1; margin: 10px 25px; padding: 0px; resize: none; "></textarea>
</div>
</div>
</div>
<noscript><div style="width: 302px; height: 352px;"> <div style="width: 302px; height: 352px; position: relative;"> <div style="width: 302px; height: 352px; position: absolute;"> <iframe src="//www.google.com/recaptcha/api/fallback?k=XXX" frameborder="0" scrolling="no" style="width: 302px; height:352px; border-style: none;"> </iframe> </div> <div style="width: 250px; height: 80px; position: absolute; border-style: none; bottom: 21px; left: 25px; margin: 0px; padding: 0px; right: 25px;"> <textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 80px; border: 1px solid #c1c1c1; margin: 0px; padding: 0px; resize: none;" value=""> </textarea> </div> </div> </div></noscript>
</div> |
Here is a hack that worked for me: .gc-reset{ gc-reset is a class that is used in three wrappers around the imageselect, so the transform is applied three times. |
@recfish That's how I did it as well, not very beautiful but it works. |
Why is this not being fixed? A lot of websites are responsive, and a lot of traffic goes via mobile devices. It makes no sense that recaptcha is not responsive as well. |
I really agree with that but for me, as a workaround the scale thing was working for me. |
Hopefully scaling this will work across devices but seriously.... Why isn't this fixed yet???? |
+1... It's sort of unbelievable that this is not responsive. And what's with the id-less, class-less |
For Bootstrap 3 (+ 480px breakpoint hack) the following code (written in SCSS) partially solved my problem: // Extra small (<480px)
@media(max-width: $screen-xs-max){
.g-recaptcha iframe {
max-width: 100%;
transform:scale(0.77);
-webkit-transform:scale(0.77);
transform-origin: center center;
-webkit-transform-origin: center center;
}
#rc-imageselect {
transform:scale(0.77);
-webkit-transform:scale(0.77);
transform-origin:0 0;
-webkit-transform-origin:0 0;
}
}
// Medium small (>=480px)
@media(min-width: $screen-ms-min){
#rc-imageselect {
transform: none;
-webkit-transform: none;
}
.g-recaptcha iframe {
max-width: none;
transform: none;
-webkit-transform: none;
}
}
// Horizontally center the recaptcha - applied to all widths
.g-recaptcha > div > div{
margin: 4px auto !important;
text-align: center;
width: auto !important;
height: auto !important;
} This code will horizontally center your recaptcha and scale it when width less than 480px. However, this code also hides part of the recaptcha when you have a device with less than ~403px wide. There's anyone here with more css skills than I that can solve this problem? Code based on How to resize the Google noCAPTCHA reCAPTCHA. Btw Google, please implement responsiveness support. |
Any plans or update if and when it would be made responsive? @rowan-m |
My solution is a pure JS approach. Using jquery + bootstrap 3 (img-responsive class).. though im sure it's quite easy to pull out that little bit of css related to img-responsive.
|
On small smartphones (iPhone 3, S3 mini) it's even worse: the re-captcha container gets cut off on the right. A lot of our mobile visitors still use these kind of small smartphones. It's actually quite unbelievable that Google, the creator of so many great frameworks and fierce supporter of mobile front-ends, is not capable of or willing to do a responsive re-captcha. |
Just label this: won't fix |
@goldhand because of? There should be a reason for doing a won't fix. All the solutions are workarounds for me. |
@goldhand @Chris2011: There's indeed no solution yet, it should be fixed. Right now it's little hacks and workarounds. And when the test is displayed it's completely broken. I don't understand how this bug is still open after all these months. |
@Chris2011 sorry for my sarcasm. It's been almost a year since this issue's been open but that's not an excuse to be negative. |
@goldhand ok no problem :) |
Hoping someone at google is paying attention, adding my 2 cents it needs to be fixed, maybe more voices is good, no knowing... |
+1 yes. it would be awesome if the responsiveness coud be enhanced. |
Always responsive issues with google. Had similar issues with google ads not being responsive. Adding another comment so this issue hopefully gets fixed without the need for a work around. |
Got it working with this code.
|
Thank you so much... This code works great... Warm regards... |
Such code was still mentioned comments before. See #61 (comment) and #61 (comment) |
I suspect most here are more code savvy than I, so I hesitate a bit, but offer that this code was easy to try, goes after the height rather than width so maybe hopefully includes some different phone widths, not just my iPhone 5s, is less involved than the linked to code, and does it perfectly for me... I just needed to tweak the scale a bit for my eye... Kind regards... |
I can pull request the css fix of @MiticoMedia, if that's welcome? |
bump |
… On Wed, Jan 31, 2018 at 4:09 PM, Abhigyan Tiwari ***@***.***> wrote:
👎
[image: capture]
<https://user-images.githubusercontent.com/16822592/35618443-03b49c56-06a1-11e8-9fcf-7fc5d4d23702.PNG>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#61 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AT2fUdVXBNMOka0q_84jA157YI3Vg_66ks5tQELfgaJpZM4Fo_M9>
.
--
Gobinath.B - Freelance web developer
Website : Webprow <http://webprow.com/>
|
I think you guys don't understand how complex this development is. Changing width must involve thousands of hours of hard work and cutting edge skills. Remember adding color on a text in CSS? It's even worse. |
@bmalaud are you serious? |
@Jimmaki I don't think so ;) |
Here is JavaScript code using jQuery to do so:
IMP Note : It will support All Devices, above and bellow 320px width as well. |
@ParmarVjay Thank you - this works. In my application, I also ran it on window resize so that reCaptcha remains responsive when container width changes.
|
@ParmarVjay Added your snippet just before didn't do anything. |
To expand on @tomanistor, I added a part to resize back to normal if the screen is wide enough (for example, flipping from portrait to landscape and vice versa).
|
I'm updating things on the |
Example hosted at https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php |
...and here we are nearly the end of 2018 and this is still an issue; piss poor Google, piss poor. |
+1 This is still a problem. Why hasn't this been patched yet? |
The example is for v3 the invisible one, the ticket is about v2 where v3 didn't exist until now. So if v2 still relevant for the users, please reopen the ticket. This will not solve the initial problem of the styling. thx. @rowan-m |
3 and half years have passed and still we dont have responsive re-captcha :( |
It seems like the responsiveness issues come from the fact that it's in an iframe and it can't really tell the size of it boundaries from in there. I'm surprised we can apply styles to it. |
+1 |
Dear Google, It's 2019. People have begun using their phones to access the internet. 🤯Also, V3 is not a new version, but rather a completely different approach to bot mitigation. Please fix V2. Thank you, |
++1 I really really dislike the V3 approach, it is an utterly insane time consuming frustration when it triggers. and I refuse to expose any of my clients or their clients to the possibility of it... Whenever I trigger V3 I tend to leave the page if I can... I suspect most people do... |
If anyone stumbles upon this and still looks for a solution for V2 just something which I found worked for me. Ill update this with a fiddle when I get home to demonstrate the idea: I had a similar issue for the recaptcha checkbox itself I ended up recreating the recaptcha box (the surrounding element). Basically you adjust the iframe to contain just the checkbox and the i am not a robot text i then recreated the whole area surrounding the recaptcha so that it can be restyled. Its a bit of a crude solution but it did solve this for me. As for the recpatcha challenge popup you will notice that it does not fit into the device on mobile screens. What you could do (feels like a crude solution) set up an interval which will look for an element with a class 'g-recaptcha-bubble-arrow' once located add a class to its parent div which will let you style the element. Or you could directly apply your styles via js to the parent. |
For the recaptcha popup, if you have this kind of structure: <div style="[...]">
<div style="[...]">
</div>
<div class="g-recaptcha-bubble-arrow" style="[...]">
</div>
<div class="g-recaptcha-bubble-arrow" style="[...]">
</div>
<div style="[...]">
<iframe title="recaptcha challenge"
src="https://www.google.com/recaptcha/api2/[...]"
name="[...]" frameborder="0" scrolling="no"
sandbox="[...]"
style="[...]">
</iframe>
</div>
</div> you can use .g-recaptcha-bubble-arrow + div:not(.g-recaptcha-bubble-arrow) {
overflow-y: scroll;
height: 90vh !important;
} it will add scrollbar in the popup |
Its been some time since i looked at it but to give an example if what I meant by my comment i created this little "plugin" if you could call it that. I have to fix a few things for it but it may give someone an idea. https://github.com/datorman/ResponsiveRecaptchaV2 Not a perfect solution but hopefully can help someone. |
Really the issue is the style |
Thanks everyone! I used some of the advice above but was having trouble with it being centred on mobile. See the following for my full fix:
|
Test on pc, tablet, mobile.
|
As I have the problem now, the recaptcha has a fixed size and should be responsive. Here is a bug ticket from februrary: https://code.google.com/p/recaptcha/issues/detail?id=215
The text was updated successfully, but these errors were encountered: