michael / michael/editable

UX: Prevent last child from being deleted?

Open
#125 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Svelte
Stars
1.8k
Forks
150
Avg merge
11h 46m
Merged PRs (30d)
8

Description

E.g. take a list node. When you delete the last child, it's no longer clear to the user they are working with a list node. If I could prevent the deletion of the last remaining node (instead keep just an empty one) this would probably feel better to the user.

Implementation ideas:

  • allow_empty definition for node_array prop
    • when true then each time a node_array is manipulated it in the ops, it will auto-fill an empty default
    • e.g. if you created a list node with an empty list_items array it would auto fill.
    • or alternatively: throw when that invariant is violated before commiting a transaction
  • another approach would be not to touch the data layer (empty node_arrays are allowed) but just forbid the actions that could make it empty (user input) e.g. when you have the node cursor after the last item and press backspace, or when the last item is an empty text element and you have the text cursor there and press backspace (this would also lead to an empty list.list_items)

Downsides:

  • Creates some special edge cases data-model wise

Priority: Low, lets see if users really struggle with this.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Compare the proposed data-layer invariant with forbidding the user actions that empty a node array, then define the desired behavior and verify that deleting the last child still leaves the list node clear to the user.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.