NicolasCARPi / jquery_jeditable

jQuery edit in place plugin. Extendable via plugin architecture. Plugins for plugin. Really.
https://jeditable.elabftw.net
MIT License
1.74k stars 458 forks source link

placeholder option has multiple functions #245

Closed sronsiek closed 2 years ago

sronsiek commented 2 years ago

For type text the placeholder option is used to provide some default text & a clickable target when the current text string is empty. So typically some text like 'Edit' or 'Click to Edit' might be used.

In more recent versions of jeditable, the text specified in the placeholder options is also applied as HTML placeholder attribute of text / textarea input fields.

To me these are 2 different features (sharing the same name), so I think each should be controllable via a dedicated option.

In the scenario described, the text Edit or Click to Edit appears (greyed) in the text input field, which is not appropriate as the user has already performed the click to initiate the edit ...

NicolasCARPi commented 2 years ago

AFAIK the tooltip option should be used for the Click to Edit message. It should not appear as a placeholder.

sronsiek commented 2 years ago

tooltip translates to an HTML title attribute - which is is only displayed on mouseover.

I think the 'Edit' text should be permanently visible ...

Workaround is this (though I need to repeat on many pages, which is why I suggested a dedicated option):

'showfn': function (form) {
     form.find('input,textarea').removeAttr('placeholder');   // Remove placeholder text jeditable has attached
}