Skip to content
GitLab
    • Explore Projects Groups Snippets
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
  • !2336

If there is a form on a item on the dropdown menu, don't toggle the visibility of the menu.

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/mariocesar/patch-2 into master 13 years ago
  • Overview 0
  • Commits 3
  • Pipelines 0
  • Changes 3

Created by: mariocesar

This is a simple enhancement, that feels just to be a good default behavior for the dropdown library.

As the twitter account menu it self on the homepage, it has a login form as a item of the menu, while the user writes his username and passwords, it's incorrect that the menu hides on when selecting the form.

The feature is do by just disabling the click event on any form inside the dropdown menu.

  $parent.find('form').click(function(event){
    event.stopPropagation();
  });

Optionally will be good, after stopping the propagation of the click on the form, that can be trigger again if the click event comes from a button tag:

  $parent.find('form button').click(function(event) {
    $parent.trigger('click');
  });

I'm not so sure if this will be a good behavior.

Maybe is the best, just to stop the propagation on the items that the user needs for input, like input, select and option tags.

Compare
  • master (base)

and
  • latest version
    22425566
    3 commits, 2 years ago

3 files
+ 5
- 1

    Preferences

    File browser
    Compare changes
do‎cs‎
ass‎ets‎
bootst‎rap.zip‎ +0 -0
templat‎es/pages‎
component‎s.mustache‎ +1 -0
j‎s‎
bootstrap-‎dropdown.js‎ +4 -1
docs/assets/bootstrap.zip
+ 0
- 0
  • View file @ 22425566

No preview for this file type
docs/templates/pages/components.mustache
+ 1
- 0
  • View file @ 22425566


@@ -1666,6 +1666,7 @@
<ul>
<li><code>.progress-info</code></li>
<li><code>.progress-success</code></li>
<li><code>.progress-warning</code></li>
<li><code>.progress-danger</code></li>
</ul>
<p>{{_i}}Alternatively, you can customize the LESS files and roll your own colors and sizes.{{/i}}</p>
js/bootstrap-dropdown.js
+ 4
- 1
  • View file @ 22425566


@@ -50,7 +50,10 @@
$parent = $(selector)
$parent.length || ($parent = $this.parent())
$parent.find('form').click(function(event){
event.stopPropagation();
});
isActive = $parent.hasClass('open')
clearMenus()
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
1
js
1
js
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
1
1 participant
Administrator
Reference: twbs/bootstrap!2336
Source branch: github/fork/mariocesar/patch-2

Menu

Explore Projects Groups Snippets