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

Slideouts #8017

Merged
merged 1 commit into from
Jun 4, 2021
Merged

Slideouts #8017

merged 1 commit into from
Jun 4, 2021

Conversation

brandonkelly
Copy link
Member

@brandonkelly brandonkelly commented Jun 4, 2021

This PR replaces the element editor HUDs with slideouts:

Screenshot of a new element editor slideout

Element editor slideouts offer the following benefits:

Slideouts can also be nested, and parent slideouts will automatically scoot over to the left, making it easier to stay oriented.

Screenshot of a nested element editor slideout

On mobile, slideouts will take up the full viewport:

Screenshot of a slideout on iOS

Invoking an element editor is identical to before:

const editor = Craft.createElementEditor('craft\\elements\\Entry', $myElement, settings);

Slideouts have been implemented as their own concept, and can be used for other applications as well. Working with them is similar to modals and HUDs:

const slideout = new Craft.Slideout(contents, settings);

The following settings are available:

  • containerElement – The type of element that should be used for the container (default is div).
  • containerAttributes – Any attributes that should be added to the container element.
  • autoOpen – Whether the slideout should be opened automatically on instantiation (default is true).
  • closeOnEsc – Whether the slideout should be closed when the Esc key is pressed (default is true).
  • closeOnShadeClick – Whether the slideout should be closed when the surrounding area is clicked on (default is true).

Finally, the PR adds two new helper JS methods:

  • Craft.trapFocusWithin() – Prevents focus from leaving a given container via the Tab key.
  • Craft.setFocusWithin() – Focuses on the first focusable element within a given container.

Resolves #3448
Resolves #3930
Resolves #4102
Resolves #6587
Resolves #4129
Resolves #4245
Resolves #6647
Resolves #6247
Resolves #5857
Resolves #6918
Resolves #7811

Resolves #3448
Resolves #6587
Resolves #4129
Resolves #6647
Resolves #6247
Resolves #5857
Resolves #6918
@Mosnar
Copy link
Contributor

Mosnar commented Jun 5, 2021

@brandonkelly I tried this out locally and it works and feels really great and refined. The only thing I noticed was that the slide-out animation missed a few frames and doesn't feel super smooth. Have you looked at adding will-change: left; to the slide-out panel right before it opens?

@brandonkelly
Copy link
Member Author

@Mosnar Just added that. Doesn’t seem like it’s making any difference for me, but YMMV. 8a1939e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants