View Issue Details

IDProjectCategoryView StatusLast Update
0026473mantisbtuipublic2020-03-15 15:23
Reporterteodor Assigned Toatrol  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.23.0 
Target Version2.24.0Fixed in Version2.24.0 
Summary0026473: Incorrect CSS rules get applied if a word in custom field name matches an existing CSS class
Description

Custom fields can contain spaces, at times custom field names are passed within the class="" attribute presumably to allow styling custom fields. However, if a custom name or part of it matches an existing CSS class, the rules of that get applied. For example if I name a custom field Date when issue resolved, it will apply all rules in the resolved class.

TagsNo tags attached.
Attached Files
image001.png (70,991 bytes)   
image001.png (70,991 bytes)   

Activities

teodor

teodor

2019-12-15 21:42

reporter   ~0063285

Here is another screenshot that hopefully captures the issue entirely.

atrol

atrol

2019-12-16 02:46

developer   ~0063286

Thanks @teodor for the detailed report.

Implemented a simple fix for it https://github.com/mantisbt/mantisbt/pull/1598

dregad

dregad

2019-12-16 03:21

developer   ~0063287

Last edited: 2019-12-16 03:22

Please take note of 1st bullet in Admin Guide, Custom Fields definition section http://mantisbt.org/docs/master/en-US/Admin_Guide/html-desktop/#admin.customize.customfields.definitions

The definition of a custom field includes the following logical attributes:

Caption variable name. This value is supplied to the lang_get() API; it is therefore mandatory to set this to a valid PHP identifier (i.e. only letters, numbers and underscores; no spaces) if you intend to translate the field label (see Section 7.2.5, “Localizing Custom Field Names”).

I'm wondering if we should not enforce this in the code instead of leaving it as a free text and implement hacks. Or if we're going to use the replace by underscore trick, then it needs to be global and consistent (and we should probably other special chars as well).

Related Changesets

MantisBT: master 18437666

2019-12-15 21:41

atrol


Details Diff
Correct CSS class names for custom fields

Not all characters are allowed to be used in CSS class names.
Replace any potentially unsupported character(s) by dashes `-`.

Fixes 0026473
Affected Issues
0026473
mod - core/custom_field_api.php Diff File
mod - core/custom_function_api.php Diff File