xability / maidr

Multimodal Access and Interactive Data Representation
GNU General Public License v3.0
24 stars 7 forks source link

feat: unify DOM properties for highlight element across all plots #539

Open krishnanand5 opened 2 months ago

krishnanand5 commented 2 months ago

Migration Refactor/Reorganization

Description

This issue is to be treated as a placeholder for one of the changes that need to be accounted for during the JS-TS migration. The DOM properties of highlight element across all plots need to be unified and streamlined to allow for easy manipulation whenever required.

Motivation

Currently, we use different DOM properties for highlight element in each plot - some highlight elements are addressed using a class and some using an ID. Even the IDs and classes are not similar and this forces multiple lines of code to address events in different plots that require DOM manipulation.

Similarly, stroke and fill are two attributes that have been used interchangeably across all highlight elements. These attributes are paramount for styling the highlight element and tearing them down or updating them sometimes requires the use of both attributes when one might have been sufficient.

Proposed Solution

Identify one common class or ID for the highlight element across all plots. If CSS is a blocker for the same, identify probable solutions where the DOM manipulation procedures can be clubbed together based on attribute similarities.

Additional Context

The current implementation of DOM manipulation can be trimmed down to produce a more modular approach.

Checklist

ellvix commented 2 months ago

I expect this is not possible with the current SVGs from ggplot etc. The DOM structure for the SVGs is just fundamentally different between different chart types. The current selectors used for each have already been refined a few times and are as general as we could get after some effort.

If we want to standardize the selectors / DOM properties, I see 2 options:

@krishnanand5 thoughts?