Field justification class not on field if views default classes disabled

Created on 30 January 2017, almost 8 years ago
Updated 15 June 2023, over 1 year ago

In the Format settings, I have two fields set to align right. However, if I turn off "Add default classes" for style settings at the field level, the alignment doesn't work for the field data, though it does still apply to the column heading. See example screenshot.

It may be argued that when turning off "Add default classes", this class really should *not* be added, but I think this class should not be included in the "defaults" as it is due to a setting that is selected specifically for the view, not generic default classes that views generates. We don't want all the extra classes in the markup of our pages, but we do want to be able to control justification.

UPDATE: The following copied from comment #13, as requested.

In this one, see the circled "Settings" option.

This is the form shown when you click "Settings". The alignment setting circled in red is how we right-justify numeric columns.

And in the "Fields" section, I clicked on "Field Collection Item: Quantity". The "Add default classes" setting is the one I referred to in my original post. Note that we had to leave that set on all fields in the site because of this issue.

With the settings as they are shown in the above screenshots, here's the rendered HTML. One thing I hadn't noticed before is that the "views-align-right" class is added twice on the column heading (red arrows). And, as you can see, it is also on the quantity field in the detail row (yellow underscore).

Then with the alignment setting for the quantity field still set to "Right", I unchecked its "Add default classes" setting. This is the rendered HTML with those settings.

Things to note there...

  1. One of the duplicated "views-align-right" classes has been removed from the column heading for that field, and that class has also been removed from the field (td).
  2. The default field classes were not actually removed from the quantity field. Instead, it appears that the classes for that field have been duplicated from the previous field ("position_year") - see the yellow underscores.
πŸ› Bug report
Status

Active

Version

9.5

Component
ViewsΒ  β†’

Last updated about 12 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States ExTexan

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024