Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !34170

Use a streamlined way to trigger component dismiss

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged GeoSot requested to merge gs-merge-dismiss-functionality-to-method into main Jun 02, 2021
  • Overview 10
  • Commits 4
  • Pipelines 0
  • Changes 12

Till this MR:

  • plugins that support dismiss action by clicking on a data-bs-dismiss trigger, can be dismissed ONLY if the trigger is inside the plugin html.

  • Alert, makes the difference. Alert on data-bs-dismiss click, tries to parse a data-bs-target element and in case in null, it fallback on the standard way, that assumes the trigger is inside the plugin html

This MR:

introduces the enableDismissTrigger helper function, that streamlines the functionality, using the idea of Alert component.

When 'dismiss' is clicked, it searches for getElementFromSelector(event.target) || this.closest(.${Plugin.NAME}) .

Result:

  1. The dismiss trigger can be either inside the component, or with the use of data-bs-target it can be anywhere in doc
  2. the dismiss trigger will respect the disable state and will handle preventDefault in case it is an anchor

The idea came from #33324 (closed)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: gs-merge-dismiss-functionality-to-method