-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Outline for Block Behaviors #50029
Comments
I have some questions and concerns to help us figure out the right UI for the Behaviors and make sure we’re solving the right problem.
Overall, my main concern is that only shipping “single-block”, “single-trigger”, and "predetermined" behaviors is of limited value, and we should think more broadly about the use cases and the capabilities that we want to unlock! I think it should be possible to first ship very restricted “single-block” & “single-trigger” behaviors but then gradually find ways to incorporate custom triggers and parameterize the behaviors. (thanks @SantosGuillamot for pointing out to me that we can work on the Behaviors in a progressive, gradual way) |
Related to #49972 |
I like the idea of differentiating between "Behaviors" and "Triggers" and exploring the possibility of triggering behaviors from different blocks. For example, showing a popup when clicking on a button. Apart from that, it'd be great if behaviors are extensible somehow, and external plugins can easily add a behavior to an image for example. This seems to be the ideal scenario for me, providing users with a lot of flexibility and power. On the other hand, I feel it should be done cautiously, and it requires a lot of thought, especially in terms of UX and composability. I believe we can start with just behaviors that have the trigger "hardcoded" in a single-block and look for ways of abstracting it later. We just have to make sure that whatever we do now, doesn't lock these possibilities.
Regarding this, some examples that come to my mind, although I haven't thought too much if behaviors is the right mechanism for them:
And I can imagine people being creative with behaviors. That's why I feel that providing mechanisms to let them add behaviors to existing blocks could be powerful. |
Agreed :) It seems that it’s too early for the discussion about adding “triggers” and “targets”. 🙂 For now, we can just move ahead with the implementation that is needed to ship the Lightbox (#49621). Working on it in #49972.
Nice, thank you for this! |
It looks like there is a general consensus that we should first go ahead with a very minimal implementation of behaviors that is only scoped to the
Below are details provided earlier by @SantosGuillamot in a private discussion so that we can continue discussing them here in public: Behaviors UI (excluding the Global Styles UI)
Read the
It's difficult to explain the difference between the setting that controls whether a site can use the behavior or not, and the default value of the behavior, so we tried using a drawing. We are not super happy with the outcome, but here it is: Global Styles UI (not required at the beginning)These are preliminary instructions based on how the Effects panel works, but it’s not exhaustive research of what needs to be done. This may not work for our use case, so you may need to do additional research and do some things differently. Also, the Effects panel is enabled using block supports (shadow: true), but we won’t use block supports yet. So we have to figure out how to integrate that.
|
Is there any reason that I could be missing of why not using block supports? |
The challenge here is that for design elements, there is everything in place to dynamically modify the block so the color, shadow, margin works out of the box. You would need to figure out how to modify the block externally so the lightbox seamlessly integrates. |
I just tried to get my head around this topic. I'm not a technical expert, so excuse the stupid questions. As a designer I'm thinking about how a good UI and UX for that could be created. What instantly comes in my mind is something like Scratch. This is a clean interface and we could also work with triggers and behaviours, but in a much more scalable and in a intuitive way than inserting this all in the editor like in Webflow. I'm not talking about the specific UI, but the way of thinking. Is this something that was considered? (And does this even make sense? lol) |
Great summary, @michalczaplinski. It looks like a reasonable approach to start with as it covers both the aspect of controlling the UI and changing the default behavior by the theme/site. It would be also cool to be able to offer a UI control for users to optionally change the default behavior in the Site Editor in the Styles tab for all blocks or individual blocks. That would give maximum control and full flexibility. |
The PR introducing the Behaviors UI has been merged. Here are some outstanding tasks (other than Removing Interactivity API experimental flag):
|
This is a rough overview for exploring how we could connect the active proposal for frontend block interactivity with user configuration within the editor. (Read the proposal for more background on the interactivity API.)
Behaviors are meant to be reusable and composable interactive hooks that can be attached to blocks. The intended outcome is to alleviate the need for extending blocks themselves (or needing to create custom blocks) to provide augmented experiences across block types. It also aims to provide users visibility and control. These behaviors can range from simple things like lightboxes to other more sophisticated effects. The essence of it is that they don't exist in the blocks themselves but can be attached to them, either programatically or by users. It should be possible to define them at a block type level (all image blocks get a lightbox behaviour) and on a per-block instance (this specific image should not get a lightbox behaviour). Other types of behaviors are what we have in the navigation block (open in overlay modal) which should be applicable to other blocks.
What this issue focuses on is on how we could structure and present reusable declaratives (i.e. "behaviors") that can be registered and attached to blocks by a user using the editor UI. Allowing composition of these behaviours is an important consideration of the design.
How behaviors themselves are built is not covered here (that's part of the interactivity API), only the declaration and UI aspects.
Overview of implications on the interface:
Outstanding questions:
This is still exploratory in nature, with a focus on figuring out how single image lighboxes could work as a stand in use case.
The text was updated successfully, but these errors were encountered: