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

Sivasish48: Issue #39287 Replacing the "show" method with a modified and Introduced a small delay before triggering the 'Offcanvas' #39593

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Sivasish48
Copy link

Description

Modifying the 'show' method with the 'Offcanvas' class and creating a small delay with 'setTimeOut' before triggering the Offcanvas

Motivation & Context

These changes are intended to make the transition work more reliably in various browsers, including Chrome.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

Related issues

…ied version and Introduced a small delay before triggering the 'Offcanvas'

Modifying the 'show' method with 'Offcanvas' class and creating a small delay wuth 'setTimeOut' before triggering the Offcanvas.
@Sivasish48 Sivasish48 requested a review from a team as a code owner January 22, 2024 05:51
Copy link
Member

@louismaximepiton louismaximepiton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indents aren't correct, some new breaklines aren't needed. please take a look at our contributing guidelines.
We won't review it for now.

@@ -102,7 +102,11 @@ class Offcanvas extends BaseComponent {
}

this._isShown = true
this._backdrop.show()
this._element.classList.add("offcanvas-end") // Adding the class 'offcanvas-end' here
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels wrong, every offcanvas isn't an offcanvas-end.

Copy link
Author

@Sivasish48 Sivasish48 Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My pardon.

show(relatedTarget) {
    if (this._isShown) {
        return;
    }

    const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, { relatedTarget });

    if (showEvent.defaultPrevented) {
        return;
    }

    this._isShown = true;

    // Adding the class 'offcanvas-end' here
    this._backdrop.show();

    if (!this._config.scroll) {
        new ScrollBarHelper().hide();
    }

    this._element.setAttribute('aria-modal', true);
    this._element.setAttribute('role', 'dialog');
    this._element.classList.add(CLASS_NAME_SHOWING);

    const completeCallBack = () => {
        if (!this._config.scroll || this._config.backdrop) {
            this._focustrap.activate();
        }

        this._element.classList.add(CLASS_NAME_SHOW);
        this._element.classList.remove(CLASS_NAME_SHOWING);
        EventHandler.trigger(this._element, EVENT_SHOWN, { relatedTarget });
    };

    // Introduce a small delay before triggering the Offcanvas
    setTimeout(completeCallBack, 50); // Adjust the delay as needed
}    

Please suggest what should be done!

@XhmikosR XhmikosR marked this pull request as draft January 23, 2024 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants