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.

Activities

teodor

teodor

2019-12-15 21:38

reporter  

image001.png (70,991 bytes)   
image001.png (70,991 bytes)   
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

View 2 revisions

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-16 02:41:14

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

Issue History

Date Modified Username Field Change
2019-12-15 21:38 teodor New Issue
2019-12-15 21:38 teodor File Added: Screen Shot 2019-12-15 at 9.13.18 PM.png
2019-12-15 21:38 teodor File Added: image001.png
2019-12-15 21:42 teodor Note Added: 0063285
2019-12-15 21:42 teodor File Added: Screen Shot 2019-12-15 at 9.40.46 PM.png
2019-12-16 02:44 atrol Assigned To => atrol
2019-12-16 02:44 atrol Status new => assigned
2019-12-16 02:44 atrol Target Version => 2.24.0
2019-12-16 02:46 atrol Note Added: 0063286
2019-12-16 03:21 dregad Note Added: 0063287
2019-12-16 03:22 dregad Note Edited: 0063287 View Revisions
2020-01-08 01:51 atrol Changeset attached => MantisBT master 18437666
2020-01-08 01:51 atrol Status assigned => resolved
2020-01-08 01:51 atrol Resolution open => fixed
2020-01-08 01:51 atrol Fixed in Version => 2.24.0
2020-03-15 15:23 vboctor Status resolved => closed