Avoid zooming inside a textarea

Asked

Viewed 63 times

0

Good afternoon, everyone,

I have the following problem and did not know how to describe a title well, I have a field that has a textarea that adapts the page width with 98%. What I want to avoid is that when the user clicks inside the zoom textarea, what is happening is that when he clicks to type the page gets much bigger and creates such a horizontal scroll bar.

  • On a mobile device

Does anyone have any tips ?

  • 1

    This would be on a mobile device?

  • Yes Kazzkiq, is giving me a headache this.

  • Have you tried adding the metatag viewport? Example: <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">

  • maybe a max-width or a max-height solve this? to lock the horizontal scroll maybe overflow-x: hidden; I don’t know if these tips can solve your problem, but I hope so

  • So when I added the viewport the site exploded and I couldn’t fix it, it makes the letters huddle together in one of the other ones.

  • I think it is better to change strategy, increase is purposeful to facilitate the life of the user, block such feature is to hinder the life of the user and provide a bad experience.

  • So, I simulated a page like facebook does in the app, when I click on Textarea it directs to another page that has a textarea with the image upload buttons, User image and the textarea takes almost the whole page put a font with 2in to get a good size for the user. When it stays in Focus it explodes a lot the original size.

Show 2 more comments

2 answers

0

First of all don’t forget the viewport.. if you don’t have it, you don’t need to read any more, there’s your problem ;)

In css there is the :focus can use this to work the element when it’s in focus and when it’s in mobile

@media (min-width:500px){
    textarea:focus{
        ...
    }
}

This way you can adjust the height as you want ;) Still it would be easier to explain and/or prove my reasoning (I haven’t tested, I’m just trying to see your problem) if you leave some of your code :)

Hug and good luck!

0

  • Can you explain how this works?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.