17
My question is about ux (user experience), it is not about material-design and the like and it is also not about "think", but about some experience in this type of functionality that has already passed with users, let’s go to the problem:
I often notice two different situations:
A load is always displayed, even if the response is quick (or not), an example of this is the votes of the site https://stackoverflow.com, by clicking to see the difference of downvotes and upvotes is displayed always the load:
Do not use load, because usually requests are quick, but these developers forget things like oscillations due to "overloads" or some temporary signal loss (this is independent of HTTP, the oscillations can be even in local programs, caused due to another program consuming the same resources)
In the first situation I felt (of the votes in the https://stackoverflow.com) that the load was so fast that perhaps it was not necessary, so my idea to solve this (what would be almost like an answer) would simply detect if the data request is taking too long and then show the load if necessary, for example (I did it in html+js, but it applies everywhere):
var rapida = document.getElementById("rapida"),
lenta = document.getElementById("lenta"),
resposta = document.getElementById("resposta"),
container = document.getElementById("container"),
tempoMinimoParaExibirLoad = 500; // Se em meio segundo não tiver ainda a resposta será exibido o load
rapida.onclick = function () {
requisitar(100); //Simula uma requisição rapida (1ms)
};
lenta.onclick = function () {
requisitar(5000); //Simula uma requisição rapida (5 segundos)
};
function requisitar(delay)
{
var timeout = setTimeout(load, tempoMinimoParaExibirLoad, true);
setTimeout(enviarResposta, delay, delay, timeout);
}
function enviarResposta(delay, timeout)
{
//Se a requisição for rapida para o timeout do load
clearTimeout(timeout);
delay /= 1000;
resposta.textContent = "Sua resposta levou " + delay + " segundos";
//Remove classe in-load se necessário
load(false);
}
function load(mostar)
{
container.classList.toggle("in-load", mostar);
}
#container > div {
padding: 10px;
}
#container .load {
display: none;
}
/*Exibe o load acaso a requisição esteja demorando*/
#container.in-load > .load {
display: block;
}
/*oculta outros elementos durante o load*/
#container.in-load > :not(.load) {
display: none;
}
<div id="container">
<button id="rapida">Requisição rápida</button>
<button id="lenta">Requisição lenta</button>
<div id="resposta"></div>
<div class="load">Carregando...</div>
</div>
Of course, this is a perception that I have of how the experience would be better for the user, but I would like to see some response that would state that something like this can actually hurt the experience or that there are better approaches or even how to improve this approach. I really hope the question isn’t too subjective.
One approach is to check the time of all requests, and if the connection is fast do not use the load. But all this work for a minimal improvement of UX, I find it unfeasible. Another important factor if you remove the load is to let the user know that there was a click, a form submission, etc
– Costamilam
Dear @Guilhermecostamilam checking the time of the request is not precisely what I formulated in the example? We’re not talking about HTTP exactly, the simulated scenario is just one example, the approach is anywhere, the question is not the minimum improvement and it’s not even possible to say that it’s minimal, but what approach would actually improve, what will be solved at the time of programming and can be something that meets all specific requests without needing to copy and paste code, but we are not discussing the level of difficulty if only the same UX ;)
– Guilherme Nascimento
Nor had I ever noticed the load, so fast it is. Only now that I looked carefully I noticed that it has
– Isac
@Isac the interesting thing is that if you don’t have the load, even fast what would probably happen? You would probably click again before the request ends... Or else for some instant you would think, "I think it worked, it must not be working" in this case you could even leave the page without knowing that she was still suing to give you a result.... In my view it should always, even if it does not appear in all scenarios. But it is my opinion, I do not have an author to substantiate my argument... :/
– hugocsl
@hugocsl I agree, because it has already happened to me on some websites, of the person clicking and not knowing if gave or not, and sometimes ends up even making refresh to try again.
– Isac
@Hugo and Isac, are coming out a little bit of the original line of the problem, this what Ugo mentioned is more of a technical problem than actually a UX problem, this can be solved in programming, like creating a flag to prevent clicks followed, what I’m talking about here is a problem caused by the load that is displayed so fast that it seems to blink on the screen, of course looking at it looks normal, but it’s so fast that sometimes it wouldn’t even be necessary, is totally about experience and not about technical problems that can be solved with flags ;)
– Guilherme Nascimento
@Isac the same thing I told Hugo above, with a flag like
if (carregando == false) { carregando = true; carregar(); carregando = false; }
(The example is pig, pq in JS we use callback, so I did in-Row pq is not a JS code, it is a "pseudo code", like a SINCRONO script running on a tread), if the user tries to access the event more than once with the IF there would prevent. But the problem is not this, this is a technical problem and there a solution with if, the question problem is even about "user experience", I understand that many things will be related, but not quite the case– Guilherme Nascimento
@Guilhermenascimento Yes, but the user does not know if his action has taken effect or not seems to me to be an UX problem, because the user gets confused and lost. And sometimes you end up doing something you shouldn’t, like giving full refresh on the page to try again (as I’ve done a few times). This is actually independent
– Isac
@Isac the question is millionth of a second, it is something almost imperceptible to the user, I will ask the question in another way so that you and Ugo notice better: if the delivery of the answer (repeating, is independent of HTTP, applicable in any scenario) is very fast what is best, worry about showing the load or worry about displaying the briefest populated data?
– Guilherme Nascimento