Problem/Motivation

Since Tagify offers some nice features like reordering by drag and drop, I would like to extend its use beyond tagging texts to using it a default widget for (content) entity reference fields.

Referenced content entities can have longer texts that are pre-wrapped in the CSS by the .tagify__tag>div>* rule. This does not look nice in a form on small screens, as shown in the picture below.

Tagify on mobile screen

Question: could we abandon the "white-space: pre-wrap;" setting (at least on small screen devices)?
Some other CSS tweaks may also be necessary in this case (like restyling the remove button).

Issue fork tagify-3517434

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

marksmith created an issue. See original summary.

gxleano made their first commit to this issue’s fork.

gxleano’s picture

StatusFileSize
new8.42 KB

Thanks @marksmith to report this issue.

I've introduced some changes which are going to fix the problem in mobile.

See evidences:

Tagify fix on mobile

Maybe you could take a look at check if everything is working fine in your end.

gxleano’s picture

Status: Active » Needs review
marksmith’s picture

StatusFileSize
new30.89 KB
new32.49 KB

Thank you, @gxleano. I've tested quickly the emendations, by pasting the new css code adjustments into tagify.css.

Since part of the css code is loaded into tagify via cdn (tagify.min.css, as defined in libraries.yml), there was some interaction with the max-width set there to 100%, for both the .tagify and the .tagify>div selectors. (I've tried to remove interference by unflagging the css grabbed from the cdn).

Anyway, there is, as far as I can see, still some room for improvement.
1. In the Claro theme, the tagify__tag-remove-button shrinks.
2. In the Gin theme, the new max-width settings are not applied correctly (remove button is also missing for long texts). If I force it, (via !important), the max-width is also set in case of texts where it shouldn't (like short tags).

See the attached screenshots for the same form:

In Claro:
Tagify in Claro

In Gin:
Tagify on Gin

gxleano’s picture

Status: Needs review » Needs work
gxleano’s picture

Status: Needs work » Needs review
gxleano’s picture

Thanks for the review @marksmith!

Now it should works as expected.

marksmith’s picture

StatusFileSize
new36.8 KB

Thanks for your efforts! Almost there, except that the ellipsis (...) also appears for short tags (where it shouldn't), but only in case the tag contains no other included elements, like ID or info label. See attached screenshot (Gin and Claro is the same).

Tagify on Gin

I think it's a .tagify__tag-text selector issue (set to max-width: 75% !important), which should be 100% if there are no other included elements, and 75% with included elements (like info label).

gxleano’s picture

Version: 1.2.37 » 1.2.x-dev
Status: Needs review » Fixed

  • gxleano committed d5194945 on 1.2.x
    Issue #3517434: Fix tag styling in mobile
    
gxleano’s picture

Status: Fixed » Closed (fixed)