Kevin Yank wrote:
> I'm using text-field() in our custom CSS to allow the user to edit an
> attribute within the document view:
> 
>   content: text-field(attribute, id);
> 
> While this generally works well, there is one issue we've experienced:
> 
>    1. Type a value into the field and press Enter to apply it.
>    2. Delete the contents of the field. Press Enter. The change is not
>       applied.
>    3. Attempt to move the cursor to another part of the document. Focus
>       remains in the field.
>    4. Type another value into the field and press Enter. Focus can now
>       be moved elsewhere.
> 
> In summary, once a value has been applied to an attribute, you can't
> delete the contents of a text-field() bound to that attribute.
> 
> Is this the expected behaviour?

Yes. Here's what happens:

>    1.  Type a value into the field and press Enter to apply it.

OK.

>    2. Delete the contents of the field. Press Enter. The change is not 
> applied.

In this case, an *empty* *string* is probably an invalid value for the
attribute. The change *cannot* be applied.

>    3. Attempt to move the cursor to another part of the document. Focus 
> remains in the field.

Yes. The user is expected to fix the content of the text-field or *to*
*press* *Esc* *to* *discard* *the* *change*.

>    4. Type another value into the field and press Enter. Focus can now be 
> moved elsewhere.

This confirms what I've said.

--> In summary, form components embedded in the document view have been
designed to work smoothly by pressing on the Esc and Tab keys.
(No need to press Enter to commit the attribute value: just ``Tab out''
of the field!)



> once a value has been applied to an attribute, you can't delete the contents 
> of a text-field() bound to that attribute.

This is a totally orthogonal problem.

One could imagine an option of text-field which would say: "empty string
means delete the attribute".

There is currently no such option.  Currently, inputting the empty
string means "change the attribute value to the empty string" (which, I
agree, is often illegal).

If you and other users would like to have such option, please send RFEs
for it.



Reply via email to