Comments (9)
Interesting !
I'm noting :
event.preventDefault()
does prevent the issue when called inconfirmHandler()
.- Going zoneless and call
detectChanges()
does not fix the issue. - If
detectChanges
isn't called inconfirmHandler()
, the issue doesn't occur : the edit button being rendered plays a part here.
It definitly looks like an HTML relatedissue.
from angular.
Please have a look at this pure JS repro : https://stackblitz.com/edit/typescript-vint5d?file=index.html,index.ts
from angular.
I agree with @JeanMeche , the construction of the HTML is a bit strange.
Normal code should be something like this :
<label for="input_id" >my label</label>> <input id="input_id" type="text" name="my_input" />
Referring to the MDN documentation - label, what is actually did with the HTML code is not compliant and could lead to issues, or accessibility problems.
from angular.
@JeanMeche , @maequise thank you for your answers. But, if you look Accessibility Concerns input into label is normal and allowed.
In any case, in my opinion, good practices and accessibility should not be confused with the fact that the whole application "crashes" by doing this. In fact only now did I notice that the rest of the app also suffers from reactivity problems after issue.
It is as if the tag label captures the event of the edit button and that then remains even when we click on the others.
In my opinion this malfunction is abnormal
from angular.
Don't place interactive elements such as anchors or buttons inside a label. Doing so makes it difficult for people to activate the form input associated with the label.
I think the text is pretty clear. This is not recommanded.
from angular.
Yes it is, but it is accessibility concerns it is not technical prohibition. In fact documentation immediately shows the best practice to use the input inside label.
from angular.
I'll close it for 2 reasons :
- Button in labels are not recommended
- Since this is reproducible with bare js, this isn't an Angular issue but more likely a browser issue.
from angular.
I was playing with this more to see if it reproduces in Safari, which it does, so sharing some more findings:
the cancel
/confirm
click event for the button is handled, resulting in a rerender of the template. The edit
button reappears as edit mode was ended. Then, the label
processes the event as it's associated with the button, but it re-initiates the event likely because it determines that the event's target is not its associated button (as the associated button has since been replaced with the edit
button during the rerender). Hence, a new event is triggered on the edit
button, immediately entering edit mode again. The toggling happens without paint operation so is invisible to users.
You can avoid this by using event.preventDefault()
to stop the label's default processing of the event.
from angular.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
from angular.
Related Issues (20)
- Not all API documentation is visible HOT 1
- Effect usage causes undesirable changes in behavior to existing components due to timing HOT 4
- Optionally keeping previous Component non-destroyed while routing to a new Component HOT 3
- Angular DevTool is showing "Angular application not detected". HOT 1
- `ActivatedRoute` doesn't work in angular elements (web component) HOT 6
- docs: add docs on RouteReuseStrategy
- hostDirectives deep input mapping works implicitly and not explicitly HOT 3
- Ancors on page doesn't lead to specific id's HOT 2
- Link leads to Page Not Found
- docs: ng new not easy to find as a learner on angular.dev HOT 3
- bug: Go to definition doesn't work on the second component in a single file HOT 5
- docs: Reactive Forms disable/enable functions are not part of the Reactive Forms guide
- `await deferBlockFixture.render` hangs when `interval` is subscribed HOT 1
- angular tutorial HOT 1
- contentChild support locator array HOT 2
- angular signal not updating when using afterNextRender() HOT 3
- prerender.io compatibility with hydration HOT 9
- Angular Animations - fade in / out works for DIVs, not fully for child components (not sure if bug) HOT 2
- how to handle "document is not defined" in ng17 ssr HOT 7
- Updating a BehaviorSubject too quickly fails to trigger change detection HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.