rocklobster-in / contact-form-7

Contact Form 7 - Just another contact form plugin for WordPress.
Other
280 stars 136 forks source link

Fixed width input fields are breaking layout if button translation is too long #1447

Open Zodiac1978 opened 3 weeks ago

Zodiac1978 commented 3 weeks ago

If you insert a text tag in CF7 on a site, set up to US English, it looks like this: Bildschirmfoto 2024-07-03 um 09 01 22

If you have a site set to German (for example), the button changes its text to "Tag einfügen" and is a little bit longer, but the text input field has still a fixed width of 510 pixels, so it ends up like this: Bildschirmfoto 2024-07-03 um 09 00 53

I think this could be fixed with one more DIV and a little bit of CSS:

.tag-generator-panel .insert-box input.tag {
  flex: 1;
  margin-right: 10px;
}

.tag-generator-panel .insert-box {
  flex-direction: column;
}

.tag-generator-panel .insert-box .submitbox {
  display: flex;
}

.input-button-row {
  display: flex;
  align-items: center;
}

The input field and the button need to be wrapped in a new DIV, so we can use flexbox to group them better:

    <div class="input-button-row">
        <input type="text" name="text" class="tag code" readonly="readonly" onfocus="this.select()">
        <div class="submitbox">
            <input type="button" class="button button-primary insert-tag" value="Tag einfügen">
        </div>
    </div>

Unfortunately this breaks some JS code which is populating the input field. If I find the reason for it and can adjust this JS, I can provide a PR for this.

After modifying the HTML/CSS it looks like this: Bildschirmfoto 2024-07-03 um 09 30 07

takayukister commented 3 weeks ago

I know the current implementation of tag generator needs an overhaul. I'll do it in the next major update (6.0).