jquery ui sortable - problem with triggering target - jquery-ui

I am using jquery-3.4.1.min.js and jquery-ui-1.12.1 .
I have a problem with jquery ui sortable widget.
When I try to drag "div.container", which is child of "div.containerList" (with applied sortable), I am not able to trigger dom change on whole height of sibling element, I have to adjust dragged element vertical position.
Can somebody please explain this behavior, possibly with solution?
Thank you very much!
https://jsfiddle.net/chada090/47ku2jer/
A added some modificaton to make it more "contrast" for each element.
HTML
<div class="containerList">
<div class="container"><span class="title">test kontejner</span>
<div class="addTask">
<div class="switch">Přidat úkol</div>
</div>
<div class="taskList"></div>
</div>
<div class="container">
<span class="title">test kontejner1</span>
<div class="addTask">
<div class="switch">Přidat úkol</div>
</div>
<div class="taskList"></div>
</div>
<div class="container placeholder"><span class="title_newCont">Nový kontejner</span></div>
</div>
JS
$(".containerList").sortable({
// containment: "parent",
placeholder: "ui-state-highlight container",
change: function( event, ui ) {
console.log(ui);
}
}).disableSelection();
CSS
.containerList{
display: flex;
min-height: 600px;
}
.containerList .container{
display:inline;
margin-left: 15px;
margin-right: 15px;
flex: 0 0 300px;
min-height: 150px;
width: 300px;
display:flex;
flex-direction: column;
background: gray;
padding: 20px;
}
.container .title_newCont{
cursor: pointer;
color: blue;
}
.container .addTask{
margin-top: 10px;
margin-bottom: 10px;
background-color: white;
box-shadow: 0px 3.2px 7.2px 0px rgba(0, 0, 0, 0.18), 0px 0.6px 1.8px 0px rgba(0, 0, 0, 0.11);
min-height: 20px;
display: flex;
flex-direction: column;
align-items: center;
padding: 5px;
}
.container .taskList{
margin-top: 20px;
background: brown;
height: 20px;
}
.taskList > div{
background-color: white;
margin-top: 15px;
}
.taskList .taskItem{
margin-bottom: 10px;
background-color: white;
box-shadow: 0px 3.2px 7.2px 0px rgba(0, 0, 0, 0.18), 0px 0.6px 1.8px 0px rgba(0, 0, 0, 0.11);
min-height: 40px;
display:flex;
align-items: center;
padding: 5px;
background: blue;
}
.taskNewItem > *{
padding: 3px;
background: green;
}
.taskNewItem input{
border: none;
outline: none;
background: red;
}
.addTask .switch{
text-align: center;
width: 100%;
background: yellow;
}
.taskNewItem{
display: flex;
flex-direction: column;
}
.taskNewItem input{
width: 100%;
}
.taskNewItem .taskButtonAdd{
width: 100%;
background-color: green;
flex:0 0 40px;
font-size: 15px;
border: none;
}
.ui-state-highlight{
background-color:blue !important;
}

after reading through API documentation, I found option "tolerance", which solved my problem.
tolerance Type: String Default: "intersect" Specifies which mode to
use for testing whether the item being moved is hovering over another
item. Possible values: "intersect": The item overlaps the other item
by at least 50%. "pointer": The mouse pointer overlaps the other item.
Code examples: Initialize the sortable with the tolerance option
specified:
1 2 3 $( ".selector" ).sortable({ tolerance: "pointer" });

Related

CSS custom properties in an absolutely positioned pseudo-element

This absolutely positioned pseudo-element has a position:relative parent. We should expect its border styles to be applied, but they are not. Why?
:root {
--color-border: #E5E5E5;
--color-background: #FFFFFF;
}
.tooltip {
position: relative;
border-radius: 3px;
padding: 16px;
border: 1px solid var(--color-border);
background-color: var(--color-background);
}
.tooltip::after {
position: absolute;
top: 11px;
right: 100%;
left: -8px;
display: block;
width: 8px;
height: 16px;
pointer-events: none;
content: "";
clip-path: polygon(0 50%, 100% 0, 100% 100%);
border-width: 1px;
border-style: solid;
border-color: var(--color-border);
background-color: #ffffff;
}
.tooltip-hard-coded {
position: relative;
border-radius: 3px;
padding: 16px;
border: 1px solid #e5e5e5;
background-color: #ffffff;
}
.tooltip-hard-coded::after {
position: absolute;
top: 11px;
right: 100%;
left: -9px;
display: block;
width: 8px;
height: 16px;
pointer-events: none;
content: "";
clip-path: polygon(0 50%, 100% 0, 100% 100%);
border-width: 1px;
border-style: solid;
border-color: red;
background-color: pink;
}
<div style="display: flex; flex-direction: column">
<div style="padding: 32px;">
<div class="tooltip">With CSS variables</div>
</div>
<div style="padding: 32px;">
<div class="tooltip-hard-coded">With hard-coded values</div>
</div>
</div>
<div class="tooltip">Hi</div>
no border with the following CSS:
:root {
--color-border: #E5E5E5;
--color-background: #FFFFFF;
}
.tooltip {
position: relative;
border-radius: 3px;
padding: 16px;
border: 1px solid var(--color-border);
background-color: var(--color-background);
}
.tooltip::after {
position: absolute;
top: 11px;
right: 100%;
left: -8px;
display: block;
width: 8px;
height: 16px;
pointer-events: none;
content: "";
clip-path: polygon(0 50%, 100% 0, 100% 100%);
border-width: 1px;
border-style: solid;
border-color: var(--color-border);
background-color: var(--color-background);
}
when hard-coding a border color value, the pseudo-element only gets the style partially applied:
<div class="tooltip-hard-coded">With hard-coded values</div>
with hard-coded values:
<div class="tooltip-hard-coded">With hard-coded values</div>
What is the correct way to apply border styles to an absolutely positioned pseudo-element using CSS custom properties?
Tried several variations of the styles applied to pseudo-element; tried hard-coded values, tried changing display methods, etc

Why does the input box keep glitching on iOS but not on Android?

Does anyone know why the input box might be glitching only on iOS but works fine on Android? I have attached two videos for better explanation of this problem. Basically on iOS I would have to tap the input field twice for it to go into 'active' state and afterwards when I try type it zooms in so much into the screen to type. No issues like this in the browser as well.
iOS - https://streamable.com/e622tj
Android - https://streamable.com/4zvns6
<div
id='task-writer'
onClick={() => {
inputRef.current?.focus();
}}
>
<div className='left'>
<label>
<input
type='checkbox'
defaultChecked={checked}
onChange={() => setChecked(!checked)}
/>
<div className='checkbox-div' />
</label>
<form
className='NewTodoForm'
id='task-form'
onSubmit={handleSubmit}
ref={formRef}
>
<input
value={userInput.task}
onChange={handleChange}
id='task'
type='text'
name='task'
placeholder='Add your task here...'
autoComplete='off'
ref={inputRef}
// onFocus={() => {
// console.log('focused');
// setIsFocused(true);
// }}
// onBlur={() => {
// console.log('blurred');
// inputRef.current?.focus();
// setIsFocused(false);
// }}
/>
</form>
</div>
CSS Code:
#task-writer {
display: flex;
flex-direction: row;
width: 100%;
align-items: center;
padding: 10px;
padding-left: 20px;
padding-right: 15px;
border-radius: 20px;
background-color: #f5f7fa;
.left {
display: flex;
flex-direction: row;
width: 100%;
height: 100%;
align-items: center;
gap: 20px;
padding: 10px 0;
label {
display: grid;
place-items: center;
width: 30px;
height: 30px;
cursor: pointer;
input {
display: none;
}
form {
width: 100%;
height: 100%;
overflow: hidden;
transform: translateX(-50px);
transition: 0.25s ease;
transition-property: transform;
input {
width: 100%;
height: 100%;
border: none;
outline: none;
font-family: 'Inter var', sans-serif;
font-size: clamp(12px, 1.65vw, 16px);
font-weight: 400;
color: #000;
background-color: transparent;
}
}
}
right-calendar-date {
position: relative;
display: flex;
flex-direction: row;
height: 40px;
width: fit-content;
align-items: center;
gap: 12px;
padding: 0px 12px;
margin-left: 12px;
border-radius: 10px;
padding-right: 40px;
cursor: pointer;
color: #6d6d6d;
background-color: #EAEDEE;
opacity: 0;
pointer-events: none;
transition: 0.25s ease;
transition-property: opacity;
h4 {
overflow: hidden;
white-space: nowrap;
color: #000;
}
}
.date-form {
display: grid;
place-items: center;
height: 30px;
width: 80px;
padding: 0 16px;
border-radius: 10px;
opacity: 0;
cursor: pointer;
color: #6d6d6d;
background-color: #eaedee;
transition: 0.25s ease;
transition-property: background-color;
:hover {
background-color: #d9d9d9;
}
h4 {
font-size: clamp(12px, 1.65vw, 14px);
font-weight: 500;
}
}

problem with z-index with leaflet with IOS

I have a webpage Find a walk which uses Leaflet to enable site visitors to find a walk in the British Isles from a specific location.
The page generates a search box and map.
<div class="search-box">
<input type="text" autocomplete="off" placeholder="Search by city, town or village" />
<div class="result" ></div>
</div>
<div id="walkingBritainMapDivWrap">
<div id="walkingBritainMapDiv" class="walkingBritainMapDiv"></div>
</div>
For all browsers except IOS the lists of results from the search are displayed in front of the map. However with IOS the list of results is hidden behind the map.
I have tried using z-index on the relevant divs but this has no effects. I understand that Laeflet uses z-indez to add layers to the map which m,ight complicate the issue.
The CSS for these divs is :-
.search-box{
width: 300px;
position: relative;
display: inline-block;
font-size: 14px;
margin-bottom: 12px;
}
.search-box input[type="text"]{
height: 32px;
padding: 5px 10px;
border: 1px solid red;
font-size: 14px;
}
.result{
position: absolute;
z-index: 999;
top: 100%;
left: 0;
background-color: white;
}
.search-box input[type="text"], .result{
width: 100%;
box-sizing: border-box;
}
/* Formatting result items */
.result p{
margin: 0;
padding: 7px 10px;
border: 1px solid #CCCCCC;
border-top: none;
cursor: pointer;
}
.result p:hover{
background: #f2f2f2;
}
.walkingBritainMapDiv {
padding-top: 75%;
width: 100%;
border-width: 1px;
border-style: solid;
border-color: rgb(0, 0, 0);
z-index: 0;
}
Any help would be appreciated to solve this problem.

CSS Tooltip Div and overflow hidden

I have a sidebar and inside it is a list of items and on some of them I will have a div/tooltip that will appear but I can't get the tooltip to show because of overflow-x:hidden
Is there a way to get .gps-tooltip in view where it is in my fiddle?
jsFiddle
html
<div class="menu_side">
<div class="wrapper">
<ul>
<li>List Item</li>
<li>List Item</li>
<li>
<input type="text" name="data_gpd" placeholder="That tooltip should be viewable">
<div class="gps-tooltip">
<input type="text">
</div>
</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
</ul>
</div><!-- /.wrapper -->
</div>
CSS
html, body {
min-width: 1009px;
min-height: 670px;
overflow: hidden;
height: 100%;
background-color: #f0f0f0;
font-family: 'Droid Sans', sans-serif;
-webkit-font-smoothing: antialiased;
margin: 0;
font-size: 75%;
line-height: 1.5;
position: absolute;
width: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
li {
font-size: 16px;
line-height: 24px;
}
ul, ol {
list-style: none;
list-style-image: none;
margin: 0;
padding: 0;
}
.menu_side {
top: 80px;
opacity: .9;
display: block;
width: 300px;
z-index: 10;
}
.menu_side .wrapper {
width: 299px;
height: 100%;
background-color: #f8f8f8;
border-right: 1px solid #d3d3d3;
overflow-y: auto;
overflow-x: hidden;
z-index: 5;
}
.menu_side .wrapper li {
border-bottom: 1px solid #d3d3d3;
padding: 10px;
position: relative;
float: left;
width:100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
transition: background .1s ease-in
}
.menu_side .wrapper li:hover {
background: #f0f0f0;
}
.gps-tooltip {
padding: 10px;
background: #fff;
border: 1px solid #d3d3d3;
position: absolute;
right: -270px;
z-index: 15;
top:0;
}
input[type=text]{
font-size: 12px;
font-weight: 700;
letter-spacing: 1px;
background: #d3d3d3;
color: #fff;
display: inline;
text-align: left;
text-shadow: none;
width: 244px;
padding: 8px;
position: relative;
float: left;
border: none;
-webkit-appearance: none;
outline: none;
}
.gps-tooltip:after, .gps-tooltip:before {
right: 100%;
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.gps-tooltip:after {
border-color: rgba(255, 255, 255, 0);
border-right-color: #ffffff;
border-width: 10px;
margin-top: -10px;
}
.gps-tooltip:before {
border-color: rgba(211, 211, 211, 0);
border-right-color: #d3d3d3;
border-width: 11px;
margin-top: -11px;
}
I am assuming the input field <input type="text" name="data_gpd" placeholder="That tooltip should be viewable"> isn't supposed to be in the list item of your jsfiddle.
But I made some slight changes to your css, removing the overflow is going to be the first thing you would have to do to make the tooltip appear. As far as I know there is no other way around an overflow hidden.
.menu_side .wrapper {
background-color: #F8F8F8;
border-right: 1px solid #D3D3D3;
display: block;
height: 100%;
width: 299px;
z-index: 5;
}
.menu_side .wrapper li {
-moz-box-sizing: border-box;
background-color: #FFFFFF;
border-bottom: 1px solid #D3D3D3;
padding: 10px;
position: relative;
transition: background 0.1s ease-in 0s;
}
.gps-tooltip {
background: none repeat scroll 0 0 #FFFFFF;
border: 1px solid #D3D3D3;
left: 100%;
padding: 10px;
position: absolute;
top: 0;
z-index: 15;
}

CSS Flexible Box Layout on iPad

I'm trying to get a very simple layout using the flex model working on iPad.
I have a containing div that is supposed to center the content divs.
The sample code does as intended across all browsers and platforms EXCEPT on the iPad (retina).
Using various iPad emulators online will not replicate the problem. I've only been able to replicate it on the actual iPad. Here's a screenshot of what it looks like:
Any and all advice will be appreciated very much.
CSS:
.container {
width: 510px;
height: 310px;
background: red;
display: flex;
display: -webkit-flexbox;
display: -ms-flexbox;
display: -webkit-flex;
flex-direction: row;
flex-wrap: wrap;
-webkit-box-pack: center;
-moz-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
-webkit-flex-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items:center;
border: 2px solid;
padding: 5px;
margin: 0;
}
.content {
float: left;
width: 150px;
height: 150px;
background: green;
border: 2px solid;
padding: 0;
margin: 0;
}
.content2 {
float: left;
width: 150px;
height: 150px;
background: blue;
border: 2px solid;
padding: 0;
margin: 0;
}
HTML:
<div class="container">
<div class="content">
<p>Content</p>
</div>
<div class="content2">
<p>Content2</p>
</div>
</div>
You're missing some properties from the old 2009 draft (or have them named wrong). Your container CSS should look like this:
http://cssdeck.com/labs/ci9imeed
.container {
width: 510px;
height: 310px;
background: red;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-pack: center;
-moz-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
-webkit-box-align: center;
-moz-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
border: 2px solid;
padding: 5px;
margin: 0;
}
Note, however, that none of the browsers with a 2009 Flexbox implementation (Android, older Safari, older Firefox) support wrapping.

Resources