We have had a Kendo Angular implementation in place for several years now. We recently updated Kendo and Angular and we found that a click event we placed on a is now broken.
We have an outer div which contains our combobox and another div with an icon containing a click event that is broken. See the screenshot with the red arrow pointing to the broken div icon.
Below is the HTML and the css governing the div.
<div *ngIf="values.length < maxCardinality"
class="editor-row">
<kendo-combobox #selectBox
[data]="connectionCandidates$ | async"
[textField]="'_id'"
[valueField]="'name'"
[filterable]="true"
[placeholder]="'Search...'"
(selectionChange)="handleComboBoxValueChange($event)"
(filterChange)="handleFilter($event)"
class="reference-combobox">
<ng-template *ngIf="resultCount >= 50" kendoComboBoxNoDataTemplate>
<span i18n>50+ partial matches. Type more.</span>
</ng-template>
<ng-template *ngIf="resultCount == 0" kendoComboBoxNoDataTemplate>
<span i18n>No results found.</span>
</ng-template>
<ng-template kendoComboBoxItemTemplate let-dataItem>
<span class="row">
<div *ngIf="hasConnectionTo(dataItem)"
class="checkmark"></div>
<span class="item"
[ngClass]="{
connected: hasConnectionTo(dataItem)
}">
{{ dataItem.name }}
</span>
</span>
</ng-template>
</kendo-combobox>
<div
class="picker-button"
*ngIf="values.length < maxCardinality"
(click)="handleClickReferencePicker($event)"></div>
</div>
The Div at the end of this with the class "picker-button" is the broken click event.
CSS for the picker-button
.picker-button {
position: absolute;
top: 6px;
right: 32px;
cursor: pointer;
user-select: none;
outline: none;
display: flex;
flex: 0 0 auto;
align-content: center;
justify-content: center;
width: 24px;
height: 20px;
background-size: 20px 20px;
background: url($assets-dir + '/picker_multiple_blue.svg') 3px 2px no-repeat transparent;
&.disabled {
background: url($assets-dir + '/picker_multiple_grey.svg') 3px 2px no-repeat transparent;
}
}
I omitted the rest of the CSS file as I don't think its relevant.
I have moved the div outside of the div containing the combobox and I can get the click event to work. I have tinkered with removing some CSS elements as an experiment to no avail. Its worth nothing this is all within a kendo grid cell. Anyone that can toss any help would be great.
I was able to fix this by adding a z-index: 2; to the picker-button class. The Combobox updates added a z-index of 1 causing it to overwrite our click event.
Related
Not able to move the button to the right of the page and the text to the center of the page even though I have added the necessary CSS ( float right etc.,)
<div id="project-heading" style = "margin-top: 0px; padding-bottom: 0px;margin-bottom: 0px ; padding-top: 5px" text-align="center">
<span display="inline;" float = "center;" style="color: white;">Visual Analysis of US Accidents Data </span>
<button position = "absolute;" background-color ="black;" color = "white;" float ="right;" display="inline-block;" padding-left = "100%;" id="reset" onclick="reset">Reset
</button>
</div>
display, float, etc.
are all CSS variables that should be included in the style="" part of the HTML, not as keyword parameters. I have demonstrated the correct way to insert them in the snippet below. You can also use right: 0 to align an element to the right side of its parent. It is often more reliable than float. I used right: 10px in this example so the button had a bit of breathing room on its right side.
<h1>Only fixed syntax:</h1>
<div id="project-heading" style = "background: blue;margin-top: 0px; padding-bottom: 0px;margin-bottom: 0px ; padding-top: 5px; text-align: center;">
<span style = "display: inline; float : center; color: white;">
Visual Analysis of US Accidents Data
</span>
<button style="position: absolute; color: white; background-color: black; float: right; display: inline-block; padding-left: 100%" id="reset" onclick="reset">
Reset
</button>
</div>
<h1>Fully fixed version</h1>
<div id="project-heading" style = "background: blue;margin-top: 0px; padding-bottom: 0px;margin-bottom: 0px ; padding-top: 5px">
<span style = "display: inline; float : center; color: white;">
Visual Analysis of US Accidents Data
</span>
<button style="position: absolute; background-color: black; color: white; float: right; display: inline-block; right: 10px" id="reset" onclick="reset">
Reset
</button>
</div>
You have quite a few issues with your code, so let's clean them up and break down what's happening:
First off, don't style inline unless you have some specific reason for doing so. Use classes or ids or even just generic selectors but separating your HTML and your CSS will make your life much easier(and ours when you come looking for assistance! ;) )
You have tags that are opened and never closed which is causing some problems. The float isn't doing anything for you. If you want to position your button to the right of the page using absolute you need to tell it to be on the right using the right attribute. Your headline is centered, you just can't see it because it's white on a white background.
If you are going to style inline, you need to include your style information in the style="" section, otherwise, you're risking issues or invalid code altogether.
Let me know if you need any additional help or explanations :)
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
background-color: lightgrey;
}
#project-heading {
margin-top: 0px;
padding-bottom: 0px;
margin-bottom: 0px;
padding-top: 5px;
text-align: center;
}
.title {
display: inline;
float: center;
color: white;
}
.btn {
position: absolute;
right: 10px;
background-color: black;
color: white;
display: inline-block;
}
<div id="project-heading">
<span class="title">Visual Analysis of US Accidents Data </span>
<button class="btn" id="reset" onclick="reset">Reset</button>
</div>
I have div container with two buttons. When user mouse hover or keyboard focus I am showing that button. I am not able to access those button through keyboard.
Below is my sample HTML and CSS code.
<div class="ui-col ui-dropzone" tabindex="0">
<div class="ui-edit-bar">
<div class="label"></div>
<button tabindex="0" data-action="edit">Edit Row</button>
<button tabindex="0" data-action="edit">Edit Col</button>
</div>
</div>
.ui-col:hover, .ui-col:focus {
border: 1px dashed #17a2b8;
}
.ui-edit-bar {
display: none;
position: absolute;
height: 30px;
width: max-content;
padding: 0 8px;
color: #FFF;
font-family: sans-serif;
font-size: 11px;
white-space: nowrap;
z-index: 10000;
}
.ui-col:hover > .ui-edit-bar,
.ui-col:focus > .ui-edit-bar {
display: block;
}
Able to access div using keyboard. But I am not able to access buttons through keyboard.
Your CSS is causing the problem.
You only display the edit bar when the <div class="ui-col ui-dropzone" tabindex="0"> is focused.
When you focus an item within that div it no longer has focus, so it reverts to display: none; and that then hides the <button>s from the accessibility tree.
You could use the :focus-within pseudo selector and make the parent opacity 0 but the support is not great for :focus-within yet.
.ui-col.ui-dropzone{
opacity: 0;
}
.ui-col.ui-dropzone:hover,
.ui-col.ui-dropzone:focus-within{
opacity: 1;
}
<div class="ui-col ui-dropzone">
<div class="ui-edit-bar">
<div class="label"></div>
<button data-action="edit">Edit Row</button>
<button data-action="edit">Edit Col</button>
</div>
</div>
Realistically though (due to poor support for :focus-within) you would likely need a JavaScript fallback that changes the parent class when a button is focused and use that to control the opacity.
The advantage of this approach is that you are not having to add tabindex="0" everywhere so you code will be easier to maintain.
I want to render a couple of submit buttons (they stands in the center of a paragraph, right under a form) exactly as in this html code:
span {
background-color: #cbaa5c;
padding: 4px;
color: #ffffff;
text-transform: uppercase;
}
<p style="text-align:center;">
<span>
<span style="border-right-width:2px; border-right-style:solid; border-right-color:#ffffff;">
Login
</span>
<span>
>
</span>
</span>
<span>
<span class='butleftspan' style="border-right-width:2px; border-right-style:solid; border-right-color:#ffffff;">
Register
</span>
<span>
>
</span>
</span>
</p>
The code above generate these two spans that are the result I aim to achieve:
This is exactly how I want that the two working buttons (and not only two spans) appear.
I tried to obtain the same result as in the picture and code above defining buttons,tables inside of buttons, spans an everything possible in the world, but I can't achieve my purpose. Any help will be super-appreciate! Thanks in advance!
In simple terms I'd want to have a Login and a register button that appears exactly as in the picture (that i obtained from the HTML code above).
As far I understand from your question you want the same result but using a button tag, in that case you can use ::after to insert the ">" symbol and achieve with CSS this:
p {
text-align: center;
}
button {
background: #cbaa5c;
border: none;
color: white;
line-height: 2;
padding: 0 8px;
}
button:after {
content: ">";
display: inline-block;
padding-left: 8px;
margin-left: 8px;
border-left: 1px solid white;
}
<p>
<button>LOGIN</button>
<button>REGISTER</button>
</p>
I wanted to make this linkable image to have a text in a pop up box (not the type of pop up that is on w3schools, I want a classic yellowish box) when I mouseover. I tried to do it like this
<div class="folder1">
<a href="yourlinkhere" target="_self" >
<img src="https://78.media.tumblr.com/c00202bad8ae39931e34a7efa861d18b/tumblr_p70bjja6xI1x5vw3ao1_500.png" height="46" width="57"
title="This is some text I want to display." </a>
</div>
Opening the page in the link works great but there is no pop up box when I hover on it. Any help?
Currently, you are setting the title attribute to get a tooltip type hint when the element is hovered over. If this is what you are looking to do but perhaps just style the textbox to be, say, yellow, I would suggest using the following:
a {
color: #900;
text-decoration: none;
}
a:hover {
color: red;
position: relative;
}
a[data]:hover:after {
content: attr(data);
padding: 4px 8px;
color: rgba(0,0,0,0.5);
position: absolute;
left: 0;
top: 100%;
white-space: nowrap;
z-index: 2;
border-radius: 5px ;
background: rgba(0,0,0,0.5); /*Change this to yellow, or whatever background color you desire*/
}
<a data="This is the CSS tooltip showing up when you mouse over the link"href="#" class="tip">Link</a>
The above code was provided by Peeyush Kushwaha in this post. Simply change the anchor tag to your image tag, and apply styles as you see fit.
If by 'popup' you are looking for an alert to the user that requires interaction to close, you can use window.alert('text') in javascript in conjunction with the onmouseover event handler.
<img src="some_image.png" height="46px" width="57px" onmouseover="window.alert('Some Message')"/>
Otherwise, if you are looking for another element to be displayed upon mouseover of the image, you can use a bit of javascript to display a div or paragraph (really anything) upon mouseover of the img.
function showDiv() {
document.getElementById('popupBox').style.display = 'block';
}
#popupBox {
display: none;
}
<img src="some_image.png" width="41px" height="57px" onmouseover="showDiv()"/>
<div id="popupBox">Some Popup Text</div>
You can do this simply with CSS, or you can use one of many simple 'tooltip' JavaScript options. Bootstrap for example has this tooltip functionality built-in, ready to use. If you want something basic, here's a simple CSS-only approach that you can customise to your needs:
<!-- padding added here so you can see the pop-up above the folder, not necessary in-page -->
<div class="folder1" style="padding: 200px;">
<a href="yourlinkhere" target="_self" class="popper">
<img src="https://78.media.tumblr.com/c00202bad8ae39931e34a7efa861d18b/tumblr_p70bjja6xI1x5vw3ao1_500.png" height="46" width="57" />
<span class="pop-up">This is some text I want to display.</span>
</a>
</div>
<style>
a.popper {
display: inline-block;
position: relative;
}
.pop-up {
display: none;
position: absolute;
left: 0;
bottom: 100%;
padding: 1rem 1.5rem;
background: yellow;
color: black;
}
a.popper:hover .pop-up,
a.popper:focus .pop-up {
display: block;
}
</style>
Basically, you position the a tag relatively so that it can have absolutely positioned children, then relying on a:hover you show / hide the child using the child element's display property.
You can equally try this using css pseudo-element
a{
position: relative;
}
a:hover:after{
display:block;
content: "This is some text I want to display";
width: 200px;
background: yellow;
position: absolute;
top:0;
padding: 20px;
}
<div class="folder1" style="margin: 70px">
<a href="yourlinkhere" target="_self" class="">
<img src="https://78.media.tumblr.com/c00202bad8ae39931e34a7efa861d18b/tumblr_p70bjja6xI1x5vw3ao1_500.png" height="46" width="57"
</a>
</div>
There is a <div> element with child node <button> element, when I click on tab <button> element is not getting the screen focus. I can say yes, internally its getting the focus (since screen reader is able to read that particular div element). But the problem here is, as a user I am not able to see (visually) the focus on the screen for that particular element.
pthnavHideSortTxt {
text-indent: -99999em;
overflow: hidden;
border: 0;
background: transparent;
width: 25px;
margin: 0;
float: right;
margin-right: -0.8em;
margin-left: -0.8em;
height: 12px;
}
<div id="abc" class="pthnavsort pthnavsortnone" title="Sort Menu">
<button class="pthnavHideSortTxt">Menu not sorted. Click to sort in ascending order.</button>
</div>
Try with an onclick attribut.
<div style="margin-top : 5%;">
<button onclick="document.location.replace('SomeBodyOnceToldMe.html');" style="font-family: Arial; font-size : 9000px; color : green;">SHREK</button>
</div>