question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TextField widget allows horizontal resize instead of vertical

See original GitHub issue

Found a bug? Please fill out the sections below. 👍

Issue Summary

The admin widget for TextField allows vertical resize instead of vertical.

Steps to Reproduce

  1. Setup the Wagtail Bakerydemo (e.g. with https://github.com/wagtail/docker-wagtail-develop)
  2. Navigate to the “Gallery” page (ID = 70) – http://localhost:8000/admin/pages/70/edit/.
  3. Try to resize the “Introduction” field
  • Any other relevant information. For example, why do you consider this a bug and what did you expect to happen instead?

Instead of the horizontal resizing I would expect to be able to vertically resize.

Inspecting the field, you will find: style="overflow: hidden; overflow-wrap: break-word; resize: horizontal; height: 75px;"

Manually changing the resize: horizontal to resize: vertical creates the expected behaviour.

https://user-images.githubusercontent.com/24797493/119425723-bdda3580-bcbc-11eb-981d-0d15cb62971f.mov

https://user-images.githubusercontent.com/24797493/119425784-dcd8c780-bcbc-11eb-9792-2dcb7ffe03fb.mov

  • I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: (yes / no)

Technical details

  • Python version: Run python --version. -> Python 3.7.10
  • Django version: Look in your requirements.txt, or run pip show django | grep Version. -> Django 3.1.11
  • Wagtail version: Look at the bottom of the Settings menu in the Wagtail admin, or run pip show wagtail | grep Version:. -> master
  • Browser version: You can use https://www.whatsmybrowser.org/ to find this out. – Firefox 88 (macOS)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
CharStringcommented, Feb 14, 2022

This is a temporary workaround

# wagtail_hooks.py in one of your installed apps.
from wagtail.core import hooks


@hooks.register("insert_global_admin_css", order=100)
def global_admin_css():
    """Workaround wagtail issue 7210
    https://github.com/wagtail/wagtail/issues/7210
    """
    return "<style>textarea {resize:vertical !important}</style>"

And pass rows=0 to your Field or Block. Wagtail sets the default to 1 which negates the hole idea of auto resize.

0reactions
thibaudcolascommented, Nov 25, 2022

@gasman personally I’m happy with either allowing both directions of manual resizing (what I’ve merged) or none (your PR).

The point in allowing vertical resizing in addition to horizontal is that people can make a field narrower as needed, and also change the height of the field so they can still see the whole content, without having to press “Enter” in the field to let the auto-size kick in. Preventing the auto-size logic from kicking in when the field is already big enough would be nice but certainly not a blocker to supporting this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to change TextField's height and width? - Stack Overflow
yes I can update the height/fontSize attributes but there is default padding within the TextField which adds up for extra height & width,...
Read more >
3 Ways to Set Height and Width of TextField in Flutter [2022]
Let's learn the easiest way to set height and width of TextField in Flutter. We'll see all the different approaches.
Read more >
resize - CSS: Cascading Style Sheets - MDN Web Docs - Mozilla
The element displays a mechanism for allowing the user to resize it, which may be resized both horizontally and vertically. horizontal.
Read more >
SizedBox class - widgets library - Flutter - Dart API docs
A box with a specified size. If given a child, this widget forces it to have a specific width and/or height. These values...
Read more >
Layout Management | Qt Widgets 6.4.1 - Qt Documentation
Manages forms of input widgets and their associated labels. QGraphicsAnchor ... Layout attribute describing horizontal and vertical resizing policy.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found