Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(b-dropdown): handle issue with touch devices on MacOS using Safari/Firefox (Fixes #4328, #4344) #4329

Merged
merged 42 commits into from Nov 8, 2019

Conversation

@tmorehouse
Copy link
Member

tmorehouse commented Oct 31, 2019

Describe the PR

Fixes #4328
Fixes #4344

PR checklist

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Enhancement
  • ARIA accessibility
  • Documentation update
  • Other (please describe)

Does this PR introduce a breaking change? (check one)

  • No
  • Yes (please describe)

The PR fulfills these requirements:

  • It's submitted to the dev branch, not the master branch
  • When resolving a specific issue, it's referenced in the PR's title (i.e. [...] (fixes #xxx[,#xxx]), where "xxx" is the issue number)
  • It should address only one issue or feature. If adding multiple features or fixing a bug and adding a new feature, break them into separate PRs if at all possible.
  • The title should follow the Conventional Commits naming convention (i.e. fix(alert): not alerting during SSR render, docs(badge): update pill examples, fix typos, chore: fix typo in README, etc). This is very important, as the CHANGELOG is generated from these messages.

If new features/enhancement/fixes are added or changed:

  • Includes documentation updates (including updating the component's package.json for slot and event changes)
  • Includes any needed TypeScript declaration file updates
  • New/updated tests are included and passing (if required)
  • Existing test suites are passing
  • The changes have not impacted the functionality of other components or directives
  • ARIA Accessibility has been taken into consideration (Does it affect screen reader users or keyboard only users? Clickable items should be in the tab index, etc.)

If adding a new feature, or changing the functionality of an existing feature, the PR's
description above includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)
tmorehouse added 2 commits Oct 31, 2019
…i/Firefox
@codecov

This comment has been minimized.

Copy link

codecov bot commented Oct 31, 2019

Codecov Report

Merging #4329 into dev will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #4329      +/-   ##
==========================================
+ Coverage   99.91%   99.91%   +<.01%     
==========================================
  Files         238      238              
  Lines        4585     4592       +7     
  Branches     1286     1287       +1     
==========================================
+ Hits         4581     4588       +7     
  Misses          3        3              
  Partials        1        1
Impacted Files Coverage Δ
src/mixins/focus-in.js 100% <100%> (ø) ⬆️
src/mixins/click-out.js 100% <100%> (ø) ⬆️
src/mixins/dropdown.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f419cb4...1580cd5. Read the comment docs.

@tmorehouse

This comment has been minimized.

Copy link
Member Author

tmorehouse commented Oct 31, 2019

Awaiting on feedback from issue #4328

@jackmu95

This comment has been minimized.

Copy link
Member

jackmu95 commented Oct 31, 2019

@tmorehouse Tested it in Safari on iOS and it doesn't solve the issue. Will look into it soon.

@tmorehouse

This comment has been minimized.

Copy link
Member Author

tmorehouse commented Oct 31, 2019

@jackmu95 I wonder if this s a timing thing (or order of events) issue... maybe related to the click outside handler closing the menu, and then the subsequent button click re-opening the menu (i.e. clickout happens first, then button click happens after)

@tmorehouse

This comment has been minimized.

Copy link
Member Author

tmorehouse commented Oct 31, 2019

Hmmm I just checked, and the clickout (focusout) handler tests for focus moving to the toggler (and ignores it)... so I don't think it is a race condition between the toggle handler and the focusOut handler.

tmorehouse and others added 5 commits Oct 31, 2019
@jackmu95 jackmu95 marked this pull request as ready for review Nov 1, 2019
@jackmu95

This comment has been minimized.

Copy link
Member

jackmu95 commented Nov 1, 2019

The problem was that we listened for the focusout event of the menu to close it when the element gaining focus wasn't the toggle, the menu or an element inside it.
The detection of the element gaining focus was based on the relatedTarget given by the focusout event. Safari and some other browsers don't implement that properly and return null instead.

I've moved the close detection back to a document-wide click-out and focusin listeners.

@achen116 Can you confirm that the new deploy preview works for you?

jackmu95 added 3 commits Nov 1, 2019
@tmorehouse

This comment has been minimized.

Copy link
Member Author

tmorehouse commented Nov 1, 2019

@jackmu95 still need to wait for the deploy-preview to build... for some reason it didn't get triggered

tmorehouse and others added 3 commits Nov 1, 2019
@tmorehouse

This comment has been minimized.

Copy link
Member Author

tmorehouse commented Nov 1, 2019

@achen116, can you try out the deploy preview again now? https://deploy-preview-4329--bootstrap-vue.netlify.com/

@jackmu95 jackmu95 closed this Nov 1, 2019
@jackmu95 jackmu95 reopened this Nov 3, 2019
jackmu95 added 6 commits Nov 3, 2019
@tmorehouse

This comment was marked as resolved.

Copy link
Member Author

tmorehouse commented Nov 4, 2019

@jackmu95 we're back to a navbar issue now.... with nav-item's after a dropdown menu not running their click handler:

  <b-navbar toggleable="" type="dark" variant="info">
    <b-navbar-brand href="#">NavBar</b-navbar-brand>
    <b-navbar-toggle target="nav-collapse"></b-navbar-toggle>
    <b-collapse id="nav-collapse" is-nav>
      <b-navbar-nav>
        <b-nav-item href="#" @click="console.log('Top Navlink clicked')">Top Link</b-nav-item>
      </b-navbar-nav>
      <!-- Right aligned nav items -->
      <b-navbar-nav class="ml-auto">
        <b-nav-item-dropdown text="Lang" right>
          <b-dropdown-item href="#">EN</b-dropdown-item>
          <b-dropdown-item href="#">ES</b-dropdown-item>
          <b-dropdown-item href="#">RU</b-dropdown-item>
          <b-dropdown-item href="#">FA</b-dropdown-item>
        </b-nav-item-dropdown>
        <b-nav-item-dropdown right text="User">
          <b-dropdown-item href="#">Profile</b-dropdown-item>
          <b-dropdown-item href="#">Sign Out</b-dropdown-item>
        </b-nav-item-dropdown>
        <!-- this click handler will not run if any of the above dropdowns are open -->
        <b-nav-item href="#" @click="console.log('Bottom Navlink clicked')">Bottom Link</b-nav-item>
      </b-navbar-nav>
    </b-collapse>
  </b-navbar>

If you have one of the dropdowns opened, and click the bottom link, you will see it's click handler doesn't run due to the menu closing an changing the position of the navlink before the click happens

jackmu95 and others added 3 commits Nov 4, 2019
@tmorehouse tmorehouse changed the title fix(b-dropdown): handle issue with touch devices on MacOS using Safari/Firefox fix(b-dropdown): handle issue with touch devices on MacOS using Safari/Firefox (Fixes #4328, #4344) Nov 4, 2019
jackmu95 and others added 5 commits Nov 4, 2019
@tmorehouse tmorehouse removed the Status: WIP label Nov 5, 2019
@tmorehouse tmorehouse added this to In progress in 2.1.0 via automation Nov 5, 2019
@jackmu95 jackmu95 self-requested a review Nov 8, 2019
jackmu95 and others added 2 commits Nov 8, 2019
@tmorehouse tmorehouse merged commit 2779a0a into dev Nov 8, 2019
9 checks passed
9 checks passed
License Compliance All checks passed.
Details
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: setup Your tests passed on CircleCI!
Details
ci/circleci: test Your tests passed on CircleCI!
Details
codecov/patch 100% of diff hit (target 99.91%)
Details
codecov/project 99.91% (+<.01%) compared to f419cb4
Details
deploy/netlify Deploy preview ready!
Details
security/snyk - package.json (pi0) No manifest changes detected
2.1.0 automation moved this from In progress to Done Nov 8, 2019
@tmorehouse tmorehouse deleted the issue/4328 branch Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
2.1.0
  
Done
3 participants
You can’t perform that action at this time.