Questions tagged [stack-snippets]

Stack Snippets are runnable inline code samples. Currently HTML, CSS, and JavaScript are supported. 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
6
votes
0answers
83 views

Inline diff view in revision history breaks runnable code snippets

When viewing the inline diff view in the revision history of a post, pressing the "Run code snippet" button tries to concatenate both revisions:
16
votes
1answer
119 views

Ejecutar (Run) button background is the same color of the button text: white

This is related to Submit buttons change color when hovering on non-English Stack Overflow sites, but in this case it's a problem because the button background is the same color as the button text: ...
9
votes
0answers
70 views

I cannot type certain special characters in the snippet editor

When using the snippet editor, I cannot type the following characters: : (deletes the next word instead) = (moves cursor forward a word instead) I assume this is because the snippet editor uses ...
-11
votes
1answer
137 views

Have “Run Code Snippet” before the code

Suggestion to move the "Run Code Snippet" section of a JavaScript/HTML/CSS snippet before the code in Stack Overflow. The reason I think this will be preferable, is because if the result does not ...
8
votes
1answer
191 views

Snippets can be formatted in monospace

Example answer with bug. By indenting the snippet generating comments, you can make a pretty odd snippet style, where the button titles are shown in a monospaced font. let test = "Hello, world!";...
2
votes
0answers
33 views

Why aren't runnable code snippets formatted correctly within lists?

Consider the following code snippet. console.log("this line is all right"); console.log("but this line is indented"); This should be a part of the same bullet point but it's not. ...
11
votes
1answer
98 views

Clicking to reload an updated answer removes the code snippet buttons and removes syntax highlighting

If you are looking at an answer with a code snippet in it, and the answerer updates the answer, you see An edit has been made (etc.). If you click that, the answer is refreshed, but the code snippet ...
4
votes
0answers
50 views

Improved support for React in the code snippet editor?

Overview of Feedback Supported React Versions Development vs. Production Auto-enable Use BabelJS / ES2015 Insert React boilerplate React Version Currently, the newest version of React available in ...
5
votes
0answers
79 views

Inline Code Editor Unusable in Chrome

From what I've read, this is the proper place for this thing. I first thought tweeting you would get an answer, but I guess not. On Stack Overflow, when you answer/ask a question, you have the option ...
2
votes
2answers
45 views

How to find answers which use code snippets?

How can I find a list of answers which use code snippets? If I want to find answers having a code block for a specific tag, I can find it with the following search query: code:true is:a [C#] Is ...
2
votes
0answers
24 views

Icons in snippet editor don't match link color

On sites with non-blue accent colors, the icons next to the "Tidy" and "Reset" links in the snippet editor stay blue and don't match the accent color. For example, on Code Golf:
1
vote
0answers
45 views

The Snippets console is getting truncated too severely

Plenty of Snippets don't need HTML and just put their results in the console. See an example below. The problem is that the console only displays the last 50 lines -- which completely borks some ...
5
votes
0answers
43 views

Links overlap on snippets

With certain screen widths, the “Hide results” and “Full page” links on snippets overlap (e.g. here, you need to run the code snippet to repro) Using a smaller or bigger width makes the page ...
3
votes
1answer
73 views

Getting JS Error while clicking Copy Snippet to answer

To answer this question, I hit "Copy Snippet To Answer" button. But nothing happened. So that I checked my console and found below error. I did hard refresh and checked for the same, still getting ...
-11
votes
1answer
103 views

Why are code snippets unavailable on profiles?

I have a profile. The picture contains a unicorn, and it talks of unicorns, but when I try to insert a snippet of code about unicorns: There is no snippet button: I also tried to manually add ...
3
votes
0answers
86 views

Options from HTML select inside a Stack Overflow question or answer will be positioned fixed [closed]

As the title already tells: When someone is answering a question or creating a question with a fiddle inside and when this fiddle contains a HTML <select> element, the child <option> ...
0
votes
0answers
120 views

Code snippet has a different behavior on Chrome when running in modal or post

I am using Chrome on a Mac, and noticed that some snippets were not working as expected. The interesting part is that when you edit the snippet (on the modal) they run fine; but when you run the ...
3
votes
0answers
45 views

Allow the stack snippets console to be maximized

Consider the following stack snippet: // A Tree(a) is one of: // - null // - tree(a, Tree(a), Tree(a)) const tree = (value, left, right) => ({ value, left, right }); const buildTree =...
4
votes
0answers
37 views

Increase min-height on SE code snippets to prevent scrollbar from blocking code [duplicate]

When using Stack Exchange/Stack Overflow, anytime there's a one-line code snippet with a horizontal scrollbar, the majority of the code becomes covered. I am using Chrome v72.0.3626.109. Looks ...
2
votes
0answers
26 views

Edits to a post to provide a snippet, but the snippet doesn't work

I found an edit to a post of mine on the 4th Feb this year. To be honest, there wasn't anything wrong with the post (other than a cheeky response/salutation, which I've now removed), but the user ...
3
votes
0answers
79 views

Vertical scroll bar overlaps top static bar

In attached image, Vertical scrollbar just overlaps when code snippets is too big and am scrolling up on code snippet area that time vertical scroll will overlap to top static bar.
2
votes
1answer
54 views

Broken view after expanding a snippet

Find a post with Stack Snippet (HTML/CSS/JavaScript) and go for "Expand snippet", for example this one. I got this strange view on Chrome 70 (Windows 10):
4
votes
0answers
45 views

Why don't code snippets work in Tag Wikis?

I noticed code snippets don't work in tag wikis. E.g. https://stackoverflow.com/tags/css/info My reasoning for asking: In most front end tags there will be examples of the relevant code. Snippets ...
2
votes
1answer
40 views

How can I provide a utility on sites without Stack Snippets in an appropriate manner?

I just wrote this answer and in the last paragraph I decided to create a small utility as part of the answer. The utility is needed for the process. After submitting, I found that Android Enthusiasts ...
1
vote
1answer
112 views

Can not create Stack Snippet with YouTube API

When writing How to remove event listener on Youtube player?, I tried to create a Stack Snippet but I could not add the YouTube API client, which was needed to display the issue. The client is on ...
1
vote
0answers
32 views

Does code snippet support CSS modules?

I want to ask a question related to CSS modules (https://github.com/css-modules). Is it possible to use CSS module syntax in a snippet? Such as @value? If yes, how can I enable it?
3
votes
2answers
407 views

Embedding code sandbox

Is it possible to embed codesandbox preview in Stack Overflow? I have tried iframe, embed URL and links but none of it works.
3
votes
1answer
74 views

Creative Commons Attribution-Share Alike and licences information on delivery

is it sufficient to add the Creative Commons Attribution-Share Alike Attributions inside the source code or should it be also added inside a separate licensing file on delivery. E.g. I create a ...
5
votes
0answers
59 views

Snippet CSS content is corrupting the console display

I have encountered a bug in the Stack Overflow snippet interface. I have created a div and wrote some css in the CSS section for the same. I noticed that the div CSS content is affecting the console ...
3
votes
0answers
41 views

Snippet editor for touch devices can be opened if you show perseverance

Opening a code snippet editor via the button from the toolbar cannot be used on touch screen devices like my iPad, i.e. I see the following notice: But occasionally tapping code snippet button ...
14
votes
0answers
136 views

Add detailed help for Stack Snippets to the editor's “Code” section and the advanced help

Stack Snippets are markedly under-documented. Please update the "Code" section of the help you get when you click the (?) icon in the editor, as well as the advanced help, to provide detailed ...
5
votes
2answers
67 views

Is it new stack snippets feature: show few snippets in one scrollable block? [duplicate]

If snippets code have four spaces from start line, then in preview shown just And in finish view snippets shown in one scrollable block (function(){ // some code // some code /...
2
votes
0answers
43 views

How to add multiple HTML pages to code snippets on Stack Overflow [closed]

How do you add multiple HTML pages to code snippets on Stack Overflow? If your code is interlinked with multiple HTML pages, then how do you add multiple pages in code snippets on Stack Overflow?
2
votes
0answers
30 views

Console on snippet going behind contents

I was googling for a code and I reached this Stack Overflow page. Owl Carousel on change not working I tried running the code in answer and it will log something in console in every slide change. ...
2
votes
0answers
30 views

Is the behaviour of code snippets correct, when doing a review task?

I was reviewing a post, and it looked to me that it had an obvious error in its code-- but it had a Code Snippet button, so I decided to click it to make sure this obvious error was there. Sure ...
5
votes
0answers
28 views

Prompt for confirmation when navigating away from stack snippet

In the following specific case: Click 'Ask Question' Click the stack snippet button without entering any other text or question titles or anything in the editor first. When you navigate away from ...
3
votes
1answer
42 views

While undeleting deleted answer, the snippet seems missing

Yesterday I made an answer to this question Why does width and height affect how a flex item is rendered?. I got some downvotes and so I decided to check am I missed something. I temporarily deleted ...
16
votes
0answers
328 views

SCSS, Sass and other CSS preprocessor support for code snippets

Add a possibility to run SCSS, Sass and other CSS preprocessors (LESS, Stylus, PostCSS, maybe others) in code snippets. Many developers use CSS preprocessors. This will remove need to convert demos to ...
2
votes
0answers
55 views

Add allow-same-origin to the Stack Snippet sandox in order to be able to run Geolocation API

Related support question: ERROR(1): User denied Geolocation Please add allow-same-origin to the Stack Snippet sandbox in order to be able to use the Geolocation API. As example, the following code ...
5
votes
1answer
2k views

ERROR(1): User denied Geolocation

While I was researching in order to answer a question on Stack Oveflow en español, I decided to try the code on https://developer.mozilla.org/docs/Web/API/Geolocation/getCurrentPosition1. But I got ...
8
votes
0answers
94 views

Code snippet comments in code formatting break the formatting of the post

When special HTML comments used for snippets are present in a post, these comments break the rendering of the post. For example, consider the following markdown code (notice that the whole thing is ...
-3
votes
1answer
66 views

Code snippets numbering lines with Number Anchors

This topic has been discussed before in Why are there no line numbers in the code listings?. The most powerful reason that prevents the implement of line numbers is changing code lines numbers and ...
2
votes
0answers
19 views

Repeating Run Code Snippet row when other answer gets reloaded

In a nutshell, this is the problem: You have an answer with a code snippet. There's another answer that just got updated. You see the "an edit has..." message and click on it. The moment, the other ...
5
votes
0answers
98 views

Can't run Stack code Snippets on the mobile site

Is it a known issue that stack snippets don't have the "Run code snippet" button underneath on the mobile version of the site? Searching for this yielded nothing, both on MSE and MSO. I've posted a ...
11
votes
1answer
136 views

New code snippet causes error on submit?

StackOverflow's editor seem to have changed, or to be more precise, the settings for the snippet editor that allow to run code in questions/answers have changed. The snippets are now executed in a ...
4
votes
1answer
176 views

Do Stack Exchange sites allow to include copyright/license in code snippets?

Suppose we see an answer with a code snippet like this: // Copyright (c) 2017, <some guy's name and email> // // Permission to use, copy, modify, and/or distribute this software for any // ...
2
votes
0answers
37 views

Folding Sections in Answers [duplicate]

We already have the spoiler formatting for information that should be hidden until specifically needed (by hovering), and the code snippet formatting like this for code that can be ...
5
votes
1answer
177 views

Why is there a script error in all Stack Snippets?

I am not sure whether this has been asked before or not, or if anyone else has this problem. I get this "script error" everytime I execute any script in the code snippet tool of Stack Overflow. I have ...
4
votes
0answers
35 views

Make Ctrl+Enter a shortcut for running a Stack Snippet

It would be nice if pressing Ctrl + Enter when editing a Stack Snippet would run it.
1
vote
0answers
176 views

Dojo Toolkit (Dijit) example does not work in Stack Snippet

This snippet is adapted from http://dojotoolkit.org/documentation/tutorials/1.10/dojo_data/demo/store-adapter.html. The snippet works in FireFox, but Chrome gives a browser error: Uncaught ...