Skip to content

[4.0.0-beta.11] Popover position incorrect in RTL mode #15662

Closed

Description

@abennouna

Bug Report

Ionic Info

Ionic:

   ionic (Ionic CLI)          : 4.1.2 (~/.nvm/versions/node/v8.11.1/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.11
   @angular-devkit/core       : 0.7.5
   @angular-devkit/schematics : 0.7.5
   @angular/cli               : 6.2.2
   @ionic/ng-toolkit          : 1.0.8
   @ionic/schematics-angular  : 1.0.6

System:

   NodeJS : v8.11.1 (~/.nvm/versions/node/v8.11.1/bin/node)
   npm    : 5.6.0
   OS     : macOS High Sierra

Describe the Bug
When a document is in RTL mode, the popover starts on the absolute left relative to the clicked element.

Steps to Reproduce
Steps to reproduce the behavior:

  1. Use a document with dir="rtl" and md mode
  2. Add a popover component
  3. After presenting, if error not obvious, inspect and lower popover container opacity
  4. See error

Related Code
I can upload a code if necessary.

Expected Behavior
The right position of the popover should be aligned to the right of the clicked element.

Additional Context

  • Tested only in browser in md mode.
  • In ionic/core/src/components/popover/animations/md.enter.ts, we can change this
  const targetLeft =
    targetDim != null && 'left' in targetDim
      ? targetDim.left
      : bodyWidth / 2 - contentWidth / 2;

to

    const direction = document.documentElement.getAttribute('dir');
    const targetLeft =
      targetDim != null && 'left' in targetDim
        ? direction === 'rtl'
          ? targetDim.left - contentWidth + targetDim.width
          : targetDim.left
        : bodyWidth / 2 - contentWidth / 2;

Activity

  1. abennouna commented on Sep 19, 2018

    @abennouna
    ContributorAuthor

    Animation in RTL mode should also be inverted.

  2. abennouna commented on Jan 9, 2019

    @abennouna
    ContributorAuthor

    Closed in favor of #17012

  3. ionitron-bot commented on Feb 8, 2019

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  4. locked and limited conversation to collaborators on Feb 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions