observablehq / feedback

Customer submitted bugs and feature requests
42 stars 3 forks source link

Extra text on markdown cell creation due to auto-select/auto-complete #415

Open aaronkyle opened 2 years ago

aaronkyle commented 2 years ago

Describe the bug Auto-complete seems to be newly enabled, adding > text on Javascript cell creation starting with markdown template literal.

To Reproduce Steps to reproduce the behavior:

1/ start to create javascript cell using markdown template literal ( md ) and then press Enter twice.

Expected behavior

md`

`

Screenshots

markdown formatting

https://discordapp.com/channels/968189877642489936/972416706108616714/972425764077203497)

Desktop (please complete the following information):

mbostock commented 2 years ago

This is because when you accept the md template literal suggestion, after inserting the snippet, we immediately show the autocomplete menu again with the sort of things you can insert into an md template literal to improve discovery.

Screen Shot 2022-05-07 at 8 09 39 AM

The blockquote snippet happens to be the first suggestion, so that’s what you get if you hit Enter twice while you have the md template literal suggestion selected.

You can hit Escape after accepting the md template literal suggestion to avoid this behavior. (Or you can use Markdown cells.)

mbostock commented 2 years ago

Also, out of curiosity: why not use Markdown cells for Markdown, instead of JavaScript and the md tagged template literal?

aaronkyle commented 2 years ago

My main reason for not using markdown cells is that I find the naming to be easier with plain JS cells (direct naming vs another UI interaction). It's also aversion to the UI interaction in general that I don't click change cell types.

On Sat, May 7, 2022, 8:56 PM Mike Bostock @.***> wrote:

Also, out of curiosity: why not use Markdown cells for Markdown, instead of JavaScript and the md tagged template literal?

— Reply to this email directly, view it on GitHub https://github.com/observablehq/feedback/issues/415#issuecomment-1120225576, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARR56XZ3DYMFRH3DR75LJ3VI2BY7ANCNFSM5VKEV25A . You are receiving this because you authored the thread.Message ID: @.***>

mbostock commented 2 years ago

Can I also ask why you name markdown content? Is it for links? Or embedding/importing?

aaronkyle commented 2 years ago

Selective embedding (i.e. not all notebook cells)

On Sat, May 7, 2022, 11:32 PM Mike Bostock @.***> wrote:

Can I also ask why you name markdown content? Is it for links? Or embedding/importing?

— Reply to this email directly, view it on GitHub https://github.com/observablehq/feedback/issues/415#issuecomment-1120250641, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARR56TUVP3C2M2XT2OQWOTVI2UEBANCNFSM5VKEV25A . You are receiving this because you authored the thread.Message ID: @.***>

aaronkyle commented 2 years ago

Sorry for the terse and slow replies, was checking in from my phone. A couple of reflections: one being that this seems to be a new behavior? I will likely get accustomed to it and change the way I create cells, but generally I am not actively 'accepting' the template literal suggestion, as I am not pressing tab to complete the line. Rather, I am typing md` + enter, which is to say that I am manually creating the template literal and that enter accepts the auto-complete, and 2) isn't tab the usual key for accepting a suggestion? that is, if enter were not the accept key in my use case, then I wouldn't automatically be generating this blockquote when trying just to start a md cell with a carriage return as my first content entry.

aaronkyle commented 2 years ago

Ah, (and apologies for the chained responses... again, finally in a place and space to type a bit more), while I appreciate all the great work that the team has put into making cells type concepts more accessible to people with the UI, I am a bit 'old school' in that I tend to avoid the mouse where possible. I find the need to deliberately click to change a cell type to be disruptive; it's faster just to do a single click to start a new cell and then to type the four characters to generate a markdown cell, and then to move on, rather than to start a cell by clicking the + for a new cell on the left, moving over to the cell choice options on the right, selecting markdown, clicking back into the cell, and then starting to type.... and then, if I want to later name the cell, I have to move from outside the cell pane to the bottom of the browser window to name it.... it's a ton of mouse interactions that one can avoid with a few keystrokes. Also, it's noteworthy that using the markdown cells doesn't avoid accidental opt-in for autocomplete: If i create a cell, change it to markdown, type 'test' and hit enter, it changes to - text (so there again, I am manually having to undo actions that feel sorta 'forced'.

mbostock commented 2 years ago

I tend to avoid the mouse where possible.

Me too! (Especially when the mouse runs out of battery and I have to plug it in upside-down to recharge. Thanks for the mandatory mouse break, Apple!)

When a cell is empty, you can cycle through cell modes using the left and right arrow keys. If you find yourself in the wrong mode in a non-empty cell, you can select all, cut, left/right arrow, and then paste to switch mode. In the very near future you (as an Observable ambassador) will also be seeing a new keyboard-friendly way of using cell modes. I know it’s a pain to relearn but I hope you will give it a shot—we think cell modes (and forthcoming related work) are a huge improvement! For one, Markdown mode will give you spell correction.

I am not pressing tab to complete the line.

When the autocomplete menu is open, both tab and enter will accept the selected suggestion. To avoid accepting the suggestion you’d have to hit escape to close the autocomplete menu. We’ll discuss internally whether we’re being too aggressive with autocompletion, but it is an unavoidable tradeoff if we want to improve discoverability.

aaronkyle commented 2 years ago

Thanks Mike.

As you're thinking over the design, you might also give some consideration to how the cell mode menu at the bottom of the page appears when the browser isn't full screen. The input field to name a cell almost disappears for me even when I have a browser 'mostly' full screen. Also - It'd be nice (in my view) if the cell menu options were closer the actual cell being edited. I for a long time didn't even notice they existed!

The keyboard-centric approach keeps me nicely within the same tight space (and in my rough counting, 8 seconds to populate content and name a cell): keyboard-centric

The mouse-centric approach has me moving about quite a bit (and note that you can barely see the cell name input field - and in my rough counting, about 11 seconds to similarly populate content and name a cell - or over 30% longer for when writing these short, one-sentence cells): mouse-centric

... and should I leave this open (for later consideration about aggressive auto-complete or possibly removing enter for auto-complete and using tab only), or closed (i.e. not a bug)?

mbostock commented 2 years ago

Yes, I’m not very happy with the cell name UI either. We don’t have a fix for that yet, but we’ve been discussing it.

hellonearthis commented 2 years ago

F2 is a common key to rename things, if the cell is active F2 could activate the naming ui box.

Other idea was shift+enter to ignore the autocomplete suggestion.

mootari commented 2 years ago

We’ll discuss internally whether we’re being too aggressive with autocompletion, but it is an unavoidable tradeoff if we want to improve discoverability.

I'd argue that responding to enter (without any selection via the up/down keys) is indeed too aggressive, and should be limited to tab. In my case the autocomplete insertion got triggered during normal typing. Instead of inserting a new line I suddenly ended up with a Plot snippet: https://github.com/observablehq/feedback/issues/417