Closed ScopeyNZ closed 6 years ago
@clarkepaul For accessibility do you think we should add an A/C to make the newly added block the next thing that you tab to?
Tough one, you might want to be adding multiple blocks (one after the other). I'm thinking to remain within the popover, after selecting a new block. Happy to hear what others think. Agree it should be an AC though.
Three options as I see it:
I took at look at a few examples from others and they didn't really consider this, although clicking through the experience feels quite intuitive if you go to the new block as you mentioned @ScopeyNZ (opt. 3).
the experience feels quite intuitive if you go to the new block as you mentioned @ScopeyNZ (opt. 3).
This was my initial thought. To be honest I didn't consider the idea of even leaving the popover open after clicking to add a block.
@raissanorth has done a "part 1" PR at #404. There's still a something that needs to be addressed:
Clicking "Add block" in the designs has it just adding the block ready for in-line editing (with some fancy animations)
CreateBlock
mutation that just takes the block type? A save would have a lot more options and block type is not one of those. Creating seems quite different. The mutation could include the location of the block, similar to the sortBlockMutation
(because we have the in-line add button too) and look like:mutation AddBlockMutation($blockType:Sting!, $afterBlockId:ID) {
addBlock(
Type: $blockType
AfterBlockID: $afterBlockId
) {
ID
Title
BlockSchema
InlineEditable
IsLiveVersion
IsPublished
Version
}
}
Sounds good to me. A custom mutation which takes in the block type makes sense to me. We can either push an optimistic update to the Apollo cache with the new block or refetch the blocks again in order to re-render the new one
@ScopeyNZ For complex blocks like Forms, I think the user can add the block to the page first, then they need to click on the block to navigate away to edit it.
Adding a file/banner block that's been created via the GridFeildDetailForm that's empty currently wont be able to be expanded. This could come up as part of this ticket.
https://github.com/silverstripe/silverstripe-elemental-bannerblock/issues/11 https://github.com/silverstripe/silverstripe-elemental-fileblock/issues/5
Also, please attempt to reproduce #312 after resolving this issue - it's possible this work could unintentionally resolve it.
Done, animations are not a thing however. PR https://github.com/dnadesign/silverstripe-elemental/pull/443
338 implements an "Add Block" popover. When the various block types shown in this popover are clicked, a block needs to be added to the relevant elemental area.
A/Cs
Animations as specified by the designs are implemented