describo / crate-builder-component

A VueJS UI component to build an RO-Crate
MIT License
6 stars 3 forks source link

The behavior of entering a URL into Text-type fields is strange #58

Closed csontosreka closed 1 year ago

csontosreka commented 1 year ago

In a regular Text-type field, it is possible to enter a URL. In this case, upon the first save, the field appears as Text, with a text input box, a green checkmark next to it, and a red trash can icon.

image

If someone clicks on the green checkmark, it will become an attached URL with its controls, while the text input box remains.

image

Through some interaction, my colleague managed to add a URL without a removal field, which could only be deleted by selecting the entity and using its page.

image

Once a URL is attached like this, the text input field only accepts URLs and indicates if the format provided deviates from it.

image

marcolarosa commented 1 year ago

That's terrible! Thanks for finding and reporting it.

Describo tries to render the data with a suitable component and in this case, the URL is causing it to get confused. When the url is first defined, it's shown in a text box but the component has changed from the basic text component to the url component. You don't see of this in the UI but that's why you're getting the URL error message as it's no longer a simple text component.

Pressing the green tick box (which is now on the url component) emits an event to create a linked entity so that's why you get the URL entity when that happens.

The fix (which will come out soon) is to create a linked entity of type URL if the text component emits a url rather than patching the data as a url in text field.

marcolarosa commented 1 year ago

Fixed by b439c98c36fdc908e569084bbe49f915db8e8f9f

And released in https://github.com/describo/crate-builder-component/releases/tag/v0.38.0