Questions tagged [stack-snippets]

Stack Snippets are runnable code sandboxes of the front-end languages HTML, CSS, and JS for use within a Stack Exchange post. Use this tag for bug reports, feature requests, and discussions explicitly relevant to these snippets and their underlying technologies.

Filter by
Sorted by
Tagged with
4 votes
0 answers
59 views

Live-refresh breaks stack snippet buttons [duplicate]

If there is already a duplicate of this bug, I was unable to find it. Anyway, the bug report: If a post has a stack snippet embedded in it, and it is edited and the live-refresh 'button' clicked, ...
Daedalus's user avatar
  • 7,676
1 vote
0 answers
57 views

Why is code not highlighted and snippets not runnable after an edit? [duplicate]

When a post that contains code is edited and I click on the "An edit has been made to this post" link above it, I can see the edited post, but the code will not be highlighted unless I refresh the ...
DjaouadNM's user avatar
  • 22.5k
50 votes
1 answer
892 views

Support JavaScript ES6 modules in code snippets

Update December 2020 This month Three.js is scheduled to go ES6 module support only. No more support for <script> tags for all the loaders/controls/postprocessing etc. Three.js is fairly popular ...
gman's user avatar
  • 104k
1 vote
1 answer
124 views

Is it possible to link 2 different snippets in Stack Overflow?

When I'm creating 2 different snippets in the same question or answer like this: Snippet for window 1: function enableButton() { document.getElementById('disabled').disabled = false; ...
Omri Attiya's user avatar
  • 3,927
13 votes
0 answers
330 views

Support Dart/Flutter as code snippets [duplicate]

This is a feature request to extend the "code snippet" feature, to support Dart/Flutter. These two techs support running on the web (example), but are not in JS/HTML and therefore are incompatible ...
Rémi Rousselet's user avatar
28 votes
2 answers
399 views

Snippets aren't working when refreshing an edit

Yes the title isn't very clear but here is the steps to reproduce the issue: You are in a question page where a post (either the question or an answer) contain a snippet An edit is made to the post ...
Temani Afif's user avatar
5 votes
0 answers
168 views

Prompt new users to try Stack Snippets

I've been using SO for a fair while now and only just learned today about how to make Stack Snippets. My initial impression was that code entered into a message/post would automatically become a ...
Joss Classey's user avatar
  • 1,064
8 votes
0 answers
147 views

Snippet controls appear twice after completing a review

TL;DR: Reproduction steps: Find a post with a pending suggested edit to add a snippet; in my case, I handled the review from the "edit (1)" link rather than through /review. Switch to "rendered ...
ArtOfCode's user avatar
  • 5,702
3 votes
0 answers
61 views

Save snippet button sometimes throws an error [duplicate]

The Save & insert into post button in Stack Snippets sometimes throws an error and the popup doesn't close. Uncaught TypeError: Cannot read property 'save' of undefined When I refresh the ...
adiga's user avatar
  • 34.9k
5 votes
0 answers
178 views

Snippet with react-router-dom routing

I'm trying to run this snippet here on Stack Overflow. I'm using react-router-dom from a CDN. I'm able to match the first route, but somehow I can't change to a different route. Is it possible to ...
cbdeveloper's user avatar
  • 29.9k
20 votes
2 answers
498 views

How do I demonstrate a preventDefault problem on a link in a Stack Snippet?

I need to demonstrate a problem with using preventDefault to prevent following a link, but Stack Snippets won't let me have a link that navigates to another page or opens a new window. So how do I ...
T.J. Crowder's user avatar
19 votes
0 answers
228 views

Please make the font and color settings in the snippet editor match the result in the question's code block

I only noticed today that there is mismatch between the display in the StackSnippet editor: and the resulting HTML in the code block in the question: First of all, the color coding is different, and ...
Mr Lister's user avatar
  • 46.2k
20 votes
1 answer
357 views

Should Guided Mode allow snippets?

Currently new users are led to guided mode to ask their question. Guided mode does not have an option to add a Stack Snippet. I have a feeling, at least for JavaScript/HTML/CSS questions, this leads ...
gman's user avatar
  • 104k
69 votes
0 answers
1k views

Update the version of Babel Standalone (and others) used by Stack Snippets

Please update the version of Babel Standalone used by Stack Snippets (and update the available versions of other scripts in the drop-down lists; ideally, update that list automatically). It's ...
T.J. Crowder's user avatar
13 votes
0 answers
276 views

Do we really need to validate "file" extensions for externals in the code snippet editor?

As we all know, "file"-suffixes are effectively meaningless w.r.t. HTTP URLs. The type of the resource is determined by the Content-Type header, not its path-suffix. So, I tried to add the following ...
spender's user avatar
  • 119k
9 votes
0 answers
315 views

Is there a magic link for [snippet]? [duplicate]

Is there a page I can direct users to, giving information on how to create code snippets? I've found this one, but it's a bit old and doesn't reflect the current layout/options. Is there a magic ...
freefaller's user avatar
  • 19.7k
27 votes
1 answer
684 views

Why won't this snippet with async await work here on Stack Overflow snippet editor?

Why won't the following snippet work here on Stack Overflow? I'm trying to add some example of basic async/await and returned promises. This exact same piece of code works just fine on my development ...
cbdeveloper's user avatar
  • 29.9k
29 votes
2 answers
704 views

Stack Snippets that assign `var location` at the top scope redirect and produce “Server Error in '/' Application.”

Look at the snippet below. It's a perfectly normal snippet (look at the markdown if you don't believe me). It's not working. var location = { map: { geo: "20.471884,-157.5056", p: "...
Jack Bashford's user avatar
13 votes
1 answer
460 views

Why doesn't the code snippet's console display string-key properties of an array?

I decided to post this issue following this one (which is not a real Javascript issue in the end). After a bit of searching, I found out that string-key/value pairs of an array are not showed in the ...
Kévin Bibollet's user avatar
13 votes
0 answers
188 views

Saving a Stack Snippet resets scroll to the top of the page

I've noticed while adding Stack Snippets or editing existing ones to answers, the scroll position is being reset to the top of the page when you click "Save and Insert into Post" to save your Stack ...
TylerH's user avatar
  • 21.1k
55 votes
2 answers
1k views

Reassigning window.name inside a Stack Snippet results in unexpected popup

Run the following snippet twice (either in the post proper, or in the snippet editor). On subsequent runs, rather than the form posting to the embedded result iframe, a new window is opened: ...
CertainPerformance's user avatar
11 votes
1 answer
464 views

Is it possible to load scripts from GitHub into the code snippet editor?

I tried to show an example in this post, which was loading my custom scripts from GitHub, but the script failed with "Uncaught TypeError: $(...).selectmenu is not a function". But if I copy the ...
Black's user avatar
  • 19.1k
6 votes
1 answer
98 views

"copy snippet to answer" is not working any more

I am not able to copy the code of the question and I get this error (tested with different questions and cleared cache): This is a test snippet to see if the issue occur on meta or not. * { ...
Temani Afif's user avatar
2 votes
0 answers
36 views

Babel causes document.write to break CSS in Stack Snippets

I know that document.write is bad,¹ but this is terribly inconsistent and doesn't make much sense. document.write("babel: false"); *:after { content: "it works"; } document.write("...
wizzwizz4's user avatar
  • 6,281
22 votes
2 answers
884 views

How can I add code to the head element when posting a code snippet?

I wanted to post a code snippet with a meta tag in the document head, so I created a code snippet with a complete HTML document. Later I saw that Stack Overflow automatically creates an HTML document ...
zomega's user avatar
  • 2,086
21 votes
2 answers
1k views

All my code is properly formatted, yet I am unable to post an answer due to unformatted code. Why?

I was answering this question, and I was unable to post my answer due to containing code that is not properly formatted as code. All my code has been formatted properly as far as I can tell. Here is ...
Jodast's user avatar
  • 1,289
5 votes
0 answers
83 views

How can I search for posts that contain Stack Snippets? [duplicate]

I want to search for posts which have live Stack Snippets. Example post: the snippet markdown content is: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: ...
CertainPerformance's user avatar
9 votes
1 answer
117 views

Hide main page content while in the Stack Snippet editor so that browser Find (Control-F) behavior is intuitive

In most browsers, one can press Control-F or something similar to search the current page for a phrase. Pressing Enter will usually scroll you to the next match for the found string. This is extremely ...
CertainPerformance's user avatar
21 votes
0 answers
325 views

Hidden Stack Snippets are not accessible and violate web standards

I noticed recently in a question about accessibility, that a snippet I included (marked as hidden by default; as it includes more details then strictly necessary for the question) is not very ...
Rúnar Berg's user avatar
  • 4,504
43 votes
1 answer
514 views

Is Stack Snippet that useful when it cannot help discovering errors when writing an answer?

I just provided an answer with my first Stack Snippet. I choose to construct the answer in the snippet editor and debug it right within. My expectation was to use this great tool as a debugger which ...
Charlie's user avatar
  • 23.4k
17 votes
1 answer
762 views

Indentation of tabs and spaces is inconsistent in Stack Snippets

When I write code using JS/HTML snippet editor (orange icon): and paste code which contains one or more tab () characters as line indentation, then the snippet editor shows me this: The same code in ...
Kamil Kiełczewski's user avatar
19 votes
0 answers
325 views

SO-hosted example images for stack snippets [duplicate]

Can we have some support for example images to be built into stack snippets? Images play an important role in many examples, but afaik the only way to use one is to get a link to the SO logo, or to ...
GolezTrol's user avatar
  • 115k
7 votes
1 answer
119 views

Snippet editor format issue when pasting larger quantity of code [duplicate]

This is not the first time this has happened. I recently came across a question with this piece of code (not in a snippet): function Decode() { var temp = "", i, c = 0, out = ""; ...
kemicofa ghost's user avatar
-3 votes
1 answer
127 views

"Copy snippet to answer" not working

I saw an answer while browsing in Stack Overflow without login. There was a "code snippet" in the answer. I wanted to try the "code snippet" in this answer. But "Copy snippet to answer" option is not ...
Muhammet Can TONBUL's user avatar
3 votes
0 answers
35 views

Stack Snippets syntax completely borks when indented by four spaces [duplicate]

Here's a Stack Snippet: for(var o of document.getElementsByTagName("input")){(o=>o.addEventListener("change",e=>console.log(o.value=o.value?o.value[0]:"")))(o)}; input{width:1em;} <...
wizzwizz4's user avatar
  • 6,281
0 votes
1 answer
129 views

Can not make sure that code snippet result is updated

When I write code in a code snippet I use the "RUN" button many times to check the current state of my code, but there is no indication to make sure if the result is changed so I click the Run button ...
Ali Sheikhpour's user avatar
8 votes
0 answers
267 views

I cannot edit snippet when improving edits

As said in the title, when I find a pending edit and I try to improve it I cannot edit the snippet inside: I don't know if it was always the case but I am pretty sure I was able to do this before....
Temani Afif's user avatar
17 votes
1 answer
500 views

How to use the regular code snippets in the 2018 Stack Overflow update

I am a little confused with the new update of Stack Overflow, particularly on using the regular JavaScript/CSS/HTML code snippets we used to have to write our questions. Now the new update made it ...
MoSwilam's user avatar
  • 864
4 votes
3 answers
755 views

Use of CodeSandbox vs built-in code snippets

Getting really annoying to see a lot more questions using codesandbox like this one: Material UI transition out and in on single button click Why aren't they using the built-in code snippets? There's ...
user avatar
33 votes
0 answers
606 views

Can Stack Snippets be added to SO for Teams? [closed]

SO for Teams is targeted at teams of developers. While that's probably not a classification that applies to all its customers, I'd expect the majority of them to be technical teams. Taking that as ...
ArtOfCode's user avatar
  • 5,702
5 votes
0 answers
273 views

Missing referer header in Chrome when using code snippet

I created an answer for HERE maps autocomplete API on Stack Overflow and I'm having an issue with the HTTP_REFERER header not being sent when using Chrome browser (works fine w/ Edge and IE). This ...
Mark G's user avatar
  • 2,986
2 votes
1 answer
55 views

Console broken in old snippets

This is regarding an answer I posted long long ago, so long ago: Answer: Split string into sentences. When we try adding a snippet, by default, the comment looks like this: <!-- begin snippet: js ...
Praveen Kumar Purushothaman's user avatar
6 votes
0 answers
84 views

Snippet HTTP Error 503: service unavailable [closed]

Basically the same as this one : Stack Snippets Returning a 503 Service Unavailable Error Quite annoying. Tried with both firefox and chrome. (Sorry if it's a duplicate) A question with snippets ...
Jean-Marc Zimmer's user avatar
439 votes
1 answer
3k views

Add VueJS to preset snippet options

Request As the title says, I would like vue added to the preset libraries already present under the options portion: The following are links that can be used for this: https://cdn.jsdelivr.net/npm/...
Derek Pollard's user avatar
78 votes
0 answers
745 views

Add an option to hide or collapse less relevant snippet sections

Snippets are very useful, but often fill up a lot of the answer with irrelevant code. (E.g. in JavaScript questions, often the solution can be demonstrated by changing a tiny part of the JavaScript ...
minseong's user avatar
  • 11.6k
52 votes
1 answer
914 views

Stack Snippets Console can't output ES6 data types

console.log(new Map([["a", 1], ["b", 2]])); // console: Map(2) {"a" => 1, "b" => 2} // SO console: {} console.log(new Set([1, 2, 3])); // console: Set(3) {1, 2, 3} // SO console: {} ...
Amadan's user avatar
  • 195k
11 votes
1 answer
418 views

Using Code Snippet's JavaScript Tidy option to indent code of other languages

I've been using the JavaScript Tidy option in the Code Snippet popup to edit and indent code in Java posts. I far as I know it works perfectly fine with Java. Is it OK to do so? What other languages ...
Roshana Pitigala's user avatar
3 votes
1 answer
146 views

On every snippet with Privacy Badger: Uncaught SecurityError: Failed to read the 'localStorage' property from 'Window'

It's been bothering me for some time. Every snippet I try to run will output an error: Uncaught SecurityError: Failed to read the 'localStorage' property from 'Window': The document is sandboxed and ...
Cœur's user avatar
  • 37.9k
44 votes
2 answers
669 views

How can we keep people from using 'JavaScript/ HTML/ CSS snippet' option with other languages?

I have mostly seen that users use the JavaScript snippet option with other languages like Python, C++, and C. How can we do our best to help them understand this option? Here is a post in which a user ...
Nouman's user avatar
  • 7,127
1 vote
1 answer
58 views

Using Stack Snippets outside of Question

As mentioned here, I'd find it useful to have the ability to use stack snippets outside of the question and answer format. The idea would be to implement something very similar to a JSFiddle which we ...
Eaten by a Grue's user avatar

1 2
3
4 5
10