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

Regression: Visibility Issues with 'Delete All Rows' and 'Delete Last Row' Buttons after PR #1365 #1396

Open
YuriHeupa opened this issue Sep 28, 2023 · 1 comment
Assignees

Comments

@YuriHeupa
Copy link

General information

  • json-editor version: commit 47ee520

This bug was identified and initially discussed in #1365 (comment) on pull request #1365.

Expected behavior

When loading a schema with empty initial data for an array, and when disable_array_delete_all_rows and disable_array_delete_last_row options are set, the "delete all rows" and "delete last row" buttons should not be visible. The users should not be able to see or interact with these buttons, as it was before the introduction of pull request #1365.

Actual behavior

Currently, with the given commit 47ee520 from pull request #1365, when the editor loads a schema with empty initial data for an array, the "delete all rows" and "delete last row" buttons are always visible, regardless of the disable_array_delete_all_rows and disable_array_delete_last_row options. This is contrary to the expected behavior. Additionally, performing actions like adding and removing a row causes the buttons to disappear, which is also a strange behavior. Reverting the mentioned commit seems to fix this issue.

Steps to reproduce the behavior

  1. Build the json-editor with commit 47ee520 from pull request Feature/fix issue 1364 #1365.
  2. Load the editor with the following schema having empty initial data for the array.
{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "properties": {
        "my_boolean": {
            "title": "My Boolean",
            "format": "checkbox",
            "type": "boolean",
            "default": false
        },
        "my_array": {
            "type": "array",
            "title": "My Array",
            "items": {
                "title": "Item",
                "type": "string"
            }
        }
    }
}
  1. Observe that the "delete all rows" and "delete last row" buttons are visible even if the disable_array_delete_all_rows and disable_array_delete_last_row options are set.
  2. Add and remove a row, then notice that the buttons disappear.

For reference, a jsfiddle has been created demonstrating the actual behavior using the mentioned commit: https://jsfiddle.net/ubd873cn/

The official playground could not be used to showcase this behavior as the bug-introducing change has not been released yet.

@germanbisurgi
Copy link
Collaborator

I can confirm this. However, we haven't yet come across a solution.

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

No branches or pull requests

2 participants