Ticket #2607 (new feature)

Opened 3 years ago

Wrong CSS class name for activated Controls with multiple class names

Reported by: cdauth Owned by:
Priority: minor Milestone: 2.13 Release
Component: Control Version: 2.9
Keywords: Cc:
State:

Description

OpenLayers.Control objects have a property called displayClass that contains the CSS class name used for the div element. By default, a class name is generated from the object’s CLASS_NAME property, but the value can be overridden.

The activate() method of the Control class adds an additional CSS class to the ViewPort element, the displayClass of the Control with the suffix “Active”. This additional class is removed by the deactivate() method again.

You can assign multiple CSS classes to a HTML element by using a space as delimiter. The activate() and deactivate() methods do not handle such a displayClass correctly. Instead of appending the suffix to each CSS class on its own, the spaces are removed before creating the “Active” class. Setting displayClass to “class1 class2” creates “class1class2Active”. It should rather create “class1Active class2Active”.

A similar issue exists in OpenLayers.Control.Panel, which creates class names with the suffixes “ItemActive” and “ItemInactive” to highlight which of the controls in the panel has been selected.

Attachments

ol2607.patch Download (2.1 KB) - added by cdauth 3 years ago.
Patch to fix the issues in OpenLayers.Control and OpenLayers.Control.Panel

Change History

Changed 3 years ago by cdauth

Patch to fix the issues in OpenLayers.Control and OpenLayers.Control.Panel

Note: See TracTickets for help on using tickets.