CenterForDigitalHumanities / glossing-entries

Descriptions of new glosses and manuscripts, a data entry interface
1 stars 2 forks source link

Implement .customConfirm as a Custom Element for Better Modularity and Scope #201

Closed KamBustos closed 2 months ago

KamBustos commented 3 months ago

During the recent implementation of the .customConfirm functionality, we discussed the potential improvements to our modal system's modularity and scope isolation. While the current approach utilizing the .customConfirm class has been successful in avoiding accidental CSS or JavaScript selections, it's become clear that converting .customConfirm into a custom HTML element would offer significant benefits in terms of code organization and reusability.

As seen in glossModal.js, which effectively uses custom elements to create a pop-up gloss modal, this pattern has already proven its value within our codebase. By encapsulating functionality and styling within a custom element (e.g., ), we can enhance our application's maintainability and ensure a more robust implementation.

Changes needed:

  1. Refactor .customConfirm into a Custom HTML Element: Drawing inspiration from the existing glossModal.js, refactor the .customConfirm modal to become a standalone custom element. This will help in scoping styles and scripts to the element itself, reducing potential conflicts and improving code clarity.

  2. Ensure Compatibility and Scalability: While transitioning to a custom element, it's crucial to maintain backward compatibility and ensure that the new component integrates seamlessly with existing functionalities.

  3. Documentation and Examples: Update the project documentation to include examples and best practices for using the new custom element. This will aid in adoption and provide clear guidance for future enhancements.