-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add Column block - 1st iteration #1430
Comments
I have started to take a look how to implement this block. First thing is I would like to deal with RangeControl here. In the meantime I will provide some initial setup and try to pull as many logic from web as I can. My main concerns are connected about limited space to render multiple column layout. Do you have any concepts about design ? |
Apologies for the delay on design, I keep getting pulled into other things so I haven't had a chance to catch up on this block 😬
Sounds good 👍
In terms of display/layout, we can think of the |
Web version is switching to horizontal layout in mobile devices for landscape mode, or more correctly: ‘if the width is big enough’. Should we put some kind of logic similar to that? We used a similar approach on media & text too, but ofc it is only limited to 2 columns. We can also think this for the next iteration: |
Ideally, I think we should use a similar approach to web if possible. Something like this (video example of web):
I believe this would mean that most landscape phones (in between ~400 and ~600 would show two-per-line, and tablets (~700+ mostly would show all columns across. We also need to be mindful of split-screen tablet displays, as well. |
@jbinda @pinarol This is a quick first pass at the Columns block: Notes:
I also still need to attack the Column blocks within this, I'll add more on that tomorrow or Wednesday. |
@iamthomasbishop Can we keep the settings part same between mobile and web? I mean, the same control can sure have different designs on mobile and web but here we are using a different control for number of columns, while Slider is being used on web. We still want to have Slider and Stepper separately for mobile right? We can for sure do it like this if you feel strong about it. I just want to mention that it is contradicting with our long term goal about x-platform development. The web implementation of block settings are currently working on mobile as is, we still have some missing pieces but we already did good amount of work to make it possible. As I said, if you feel strongly about this we can do that too. |
However, if you think Stepper should be the mobile equivalent of web's Slider it is all OK then. That way it'd be still compatible with x-platform methods. |
I don't love the Slider component for a granular numerical selection that allows a small range (1-5 in this case). A Stepper or Picker is probably better in this case, even on web. If we stick with a Slider, can we at least add discrete "tick" marks to make it more obvious at a glance? See Discrete Slider example in Material guidelines. I think this might be the default for short-scale Sliders, looking at this example.
Fair enough, but I think it's very important for us to avoid going cross-platform for the sake of making our lives easier at the expense of our platform-native end-users. We should always try to find common ground, but the platform best practices will almost always win out in terms of usability in the native context. |
@iamthomasbishop It is totally ok to choose a different component from web, my request here is just making it consistent. RangeControl is part of the public @wordpress/components library, so we should make a decision about what it should render on mobile and stick to it that’s all. This is not about making things easier, we can define mobile RangeControl as a control rendering a stepper, that’s totally cool. But if we want to render different things on cases where RangeControl is used then it’ll become a problem in terms of defining the public api. 3rd party devs will also use this same component while developing 3rd party blocks. |
ok I had a small convo with @iamthomasbishop on this and I am attaching the summary of it here: TLDR: we can use RangeControl(slider) in Column block until we have a StepperControl component ready. In the meantime we don't need to block shipping Column block. |
I pin @iamthomasbishop comment referring to column block in navigation-down thread and open PR for Column Block soon |
Hi, I would like to summarise work progress on Column Block after my absence. Firstable - please check the below GIF presenting current state. Items that I did:
At this stage my concerns are:
2. Horizontal Layout At this moment I did:
At this stage my concerns are:
3.Other Features
If there is something that I missed above and it should be implemented as a Column Block part please let me know ! :) @pinarol @iamthomasbishop what do you think ? edit: One more note - the code in PR can still be messy and after refactor I remove |
hey @jbinda thanks for the summary.
Right, and the stepper component is merged & ready to use so we don't have any reason for using slider for column count anymore. let's switch to stepper in this 1st iteration.
Our readable content width is 512 max currently, even on tablets. So even if we put the logic "display all columns on 768+" it won't be active. This means we have even less space. BTW, when I check web, it shows some buggy layout in mobile Portrait(iPhone X): 4 columns: 6 columns: It doesn't look like it is an option for mobile to divide 1 row into 6 columns. We need to come up with a better way. IMHO "columns percentage width" is pretty tricky UX-wise. User has a pretty small viewport when Bottom sheet is open. Even if we let the columns wrap, user won't be able to see all columns at once and compare them with each other. It can be interesting if we try to demonstrate column ratios on a dummy view instead, for example once the user taps column ratio settings a new modal opens with showing representative empty columns, all in 1 row, and user can arrange them there instead of the real editor. Just an idea. But if we really do want to demonstrate this live in the editor, first thing that pops into my mind is letting the columns wrap and get divided into next rows by increasing the total width shared as the column count increase, I tried to explain it as below. For example, the screen width is 400 2 columns, ratios: %20 %80 Share 400 among rows |---------400--------------| //Screen width |--80--|--------320--------| //Columns 3 colums, %20 %60 %20 Share 600 among rows: |----------400--------------| //Screen width Columns: |----120----| 3 colums, %20 %20 %60 |---120---|---120----| 4 columns, %20 %40 %40 %20 Share 800 among rows: |---------400--------------| //Screen width Columns: |----160----| ... But as I said since the user won't be able to see columns on the next row there will be no chance to compare.
I'd really want to include this one assuming it will be pretty similar to media-text. But if that turns out to be too tricky let's talk. I hope I didn't miss anything. |
Ok
I have also noticed this behaviour. Playing with that I saw that the layout breaks when you add new columns when there was fixed percentage ratio before or if you manipulate percentage ratio and exceed some value depending on how many columns you added. Further more using the logic from web on mobile I saw that edit: I have checked and on web version the negative column widths value is also appears. I checked the values stored in To replicate it do as follow:
After doing that you case noticed layout breaks and see negative values in one or two Column Attribute. For larger screens layout breaks might not be observable - but negative value should be noticed.
On vertical layout we agree to have the columns stacked and that's fine on mobile. When rotated ideally it IMO should show the exact layout with ratio set on columns. The issue here is that we can not even display all 6 columns without breaking the layout (not saying about additionally set up percentage width). See image below: Here is the GIF presenting 3 columns in row. In my opinion it's the limit - adding more columns to the layout make it very hard to use. As Pinar pointed on smaller screen it also can start to breaks. Also the navigation to change column order it's not intuitive as @iamthomasbishop mentioned before. We plan to change direction of the arrows ?
I like the solution both solutions - the dummy layout and wrapping the columns. However both has props and cons. For the dummy layout the case is like you mentioned user will loose possibility to compare the exact output. Also when I thought about the Wrapping the columns allows to stack columns in row depending on order in layout. I just wonder if we do not "waste" too many space on sides putting this in that way. The benefit is that user see how each of the columns looks like. I also think that if we wrap something we should also center so according to given example below:
it becomes more like this:
@pinarol Am I correct that this scenario assume 200px initial width on each added column ? Not sure if we have another option without going for compromise like in discussed solutions. @iamthomasbishop do you have any thoughts on that ? |
I've made a progress on Columns distribution according to discussion on Slack and above. Please check below GIFs: The Columns layout depends on the block container size so it allows nested Columns to be render without break the layout ( in some point the layout of inner Columns block will be stacked ). Because we have the maximum available width hardcode to 580px even on iPad we show layout with 2 columns but the implemented logic is ready to show all 6 columns according to this comment if we extend this limit. UX notes:
Features Left
Issues
Side notes:
|
Yes I think so, otherwise it'll act weird in nested blocks. I believe this can also be reproduced in Group block with enough nesting. @lukewalczak this can be a next task for you, would you mind taking a look into this? (+ opening an issue if you think it needs solving ) Thanks in advance! ps: you might need this PR to be able to test on iOS. |
Vertical Alignment is only demonstrable when items are side by side, so we can't show it with only 1 column, no? Please correct me If I am missing something. Just like media-text, we are only able to demonstrate the vertical alignment change when media and the text is horizontally stacked. |
I'm not so sure about that. Implement bordering logic of nested blocks in group eliminate margins multiplication so even deeply nested element should have the same size.
If the logic that I have implemented in Columns block about checking the available width is ok I can also replicate it to MediaText meanwhile we are dealing with Columns block. It's up to you if you want me to take care of it as well without Luke's engagement
Ok, thanks ! I will give it a shot
That's true - user won't be able to see changes in vertical(stacked) layout but even then I think he should be able to change the alignment. In MediaText the VerticalAlignment Controls are visible all the time (see below screen) My comment about verticalAlignment refers also to web behaviour. On web you can set up column vertical alignment on Columns block level or individually for each Column. See below GIF: This feature on web also seems to be a little bit buggy in my opinion (it change both vertical and horizontal position and also change the placeholder width) I wonder if we want to implement feature to individually change the Column |
Right, they should be able to change the alignment even if they don't see it effecting the editor in some cases. When you said "Vertical Alignment for single columns" I thought you were referring to a situation where we can display only 1 column at a row, that's why I thought it was not demonstrable. Anyway, so yes, every individual column should also have its own verticalAlignment option. But I agree that web behavior looks buggy because it is changing horizontal alignment as well. And when I check the preview of the page there's no change in the horizontal alignment as expected.
Both is fine, I thought @lukewalczak needs a new task while you still have things to do on Column. I'd just want to have that fix on a separate PR and rather quicker so we won't have blockers to ship Group anymore. |
That's cool for me, will handle it |
Ok, I have already explain Luke what should be done there and as he wrote he we will manage it
I already did some investigation on it. That's the case that it is easy to add ability to change |
Hey @jbinda, sorry for the delays in getting back to this one. I'll answer your earlier questions and try to get caught up on the rest of the context.
Ideally, all block types should have the selected-block icon, but it is nice that we at least have it here. Tapping on the icon-button wouldn't do anything necessarily, but it would be interesting if we could in the future show a tooltip or re-highlight the block when it's tapped to have some feedback.
I was looking at the Columns block on web (testing on a small screen in Safari's responsive mode), and their With that said, if we can get our alignments to work properly, I would expect the
The bordering doesn't look "bad" necessarily, but I think when the appender (solid border with
Obviously it'd be ideal if the gutters were the same as the side margins, so if we can shrink the gutters so that there is 16px gutters and 16px margins (on sides) that would be great. But it's probably something we could iterate on. I think it's the same concern on web, so if we can improve upon this, bonus points.
This is a tricky one. I do think if we are stacking on portrait phone we are safe (because visually you can only move up or down), but on landscape we might want to change to left/right arrows. Side note: it'd be amazing if in the long-term we could remove arrows in favor of drag & drop re-ordering but that is likely going to be a big project in itself 😄
I think alignment could get confusing on single-column layout (example: portrait phone where we're stacking columns). The controls could get easily confused w/ "re-order". |
@iamthomasbishop thanks for answers and don't bother about late response - it wasn't blocker for me. Some of the question is solved and some needs more discussion/confirmation. Please check my response below.
Ok so I have the icon in
Not only the alignment but also setting the column widths (described above). Probably I'm going to open PR in gutenberg repo on that.
This is the way that
Yes I will try to go that way.
I will keep that in mind and back to this during future refactor when all other feature in
From the implementation point of view we only need to find a way to pass the information about direction of an arrow to Block Toolbar from Column block. We have access to all info to distinguish what. Keep in mind that even in landscape we can have Column stacked when we do some nesting. Maybe we can iterate on it in V2 of Columns Block ?
Yes. Not only in portrait phone layout. Even in landscape in some case user won't be able to see effect after changing According to current MediaText behaviour I think we should allow changing the vertical alignment should be possible even we can't see effect on mobile. What do you think ? |
I think so. Is there a component that we can add to or create to supply a re-usable "selected block icon" spot on the toolbar? If we can do it across all blocks, that'd be ideal. But if not, I still think adding icons where possible is useful.
👍 to the last 4 items above.
Sounds good to me, ship and iterate 😄
Not ideal, but I think it's something we can address during future iterations. |
Edited my responses above. |
At this moment to render this Icon we render Further more there is still For the rest things I will go according to above :) Thanks ! |
I think I handle the Is it works as you expected ? |
It looks OK to me. The focused state has FloatingToolbar which takes some space so that's why the change is not vey obvious but it'd be more obvious if the other column had longer content. BTW we started working the ideal version of FloatingToolbar lately. 🤞 |
That's true - the feeling about alignment effect depends on the However according to initial concept and discussion I think it looks nice. |
I agree the alignment controls work pretty much as I'd expect. 👍 |
I removed the border from The approach we discuss to remove the solid Appender border do not work well on Dark mode because the button gets I think if we want to change the look that I have posted originally we might try the solution with remove dashed border around the button. However like I mentioned before it can be a tricky to implement because we need to modify the logic we prepare during navigation-down PR |
@jbinda Bordering looks nice and clean on light mode, although I agree w/ your note about the "extra" visual padding 😄 Can we remove the dark gray fill on the button in dark mode? We could also remove the extra padding so that it's not quite as large and the button tap area would take up the whole "dashed" area. Does that make sense? |
Thanks for answering on that. Also apologise for late response because I had been dealing with the fixes for Group block. According to your request I think we have the same concerns here as I posted in this comment However in this case the simplest solution that I think might work pretty well is just make the dashed border transparent to visually keep only the Appender. Then we do not changing the margins (and touch the logic of border styling of InnerBlocks). Also stretching the placeholder might be necessary to align the content but I think it can be done from Column block without changing the InnerBlock logic as well |
Ok, let's try that. When you make the change, can you drop screenshots to see the diff? |
Of course, I will post you |
Please check below screen with adjusted |
We need to add a column block similar to web. Column block is basically Group block with columns and a placeholder state where you can pick an initial layout. Column block has column count slider in the inspector. And each column block has percentage slider.
cc @iamthomasbishop for more details
The text was updated successfully, but these errors were encountered: